Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clue/e3e871931d9bdb3807c41c8d5b458748 to your computer and use it in GitHub Desktop.
Save clue/e3e871931d9bdb3807c41c8d5b458748 to your computer and use it in GitHub Desktop.
Getting started with ReactPHP – Pushing real-time data to the browser (PHPUGMS)
{
"require": {
"react/event-loop": "^1.0",
"react/stream": "^1.0",
"react/socket": "^1.0",
"clue/buzz-react": "^2.3",
"clue/packagist-api-react": "^1.2",
"react/http": "^0.8.3"
}
}
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "c4e21d6e00820fb6f759c07d724fbb1a",
"packages": [
{
"name": "clue/buzz-react",
"version": "v2.3.0",
"source": {
"type": "git",
"url": "https://github.com/clue/php-buzz-react.git",
"reference": "c37408fc5265dd853c31aea4e0b409f8c8d7af11"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/clue/php-buzz-react/zipball/c37408fc5265dd853c31aea4e0b409f8c8d7af11",
"reference": "c37408fc5265dd853c31aea4e0b409f8c8d7af11",
"shasum": ""
},
"require": {
"php": ">=5.3",
"psr/http-message": "^1.0",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/http-client": "^0.5.8",
"react/promise": "^2.2.1 || ^1.2.1",
"react/promise-stream": "^1.0 || ^0.1.1",
"react/socket": "^1.0 || ^0.8.4",
"react/stream": "^1.0 || ^0.7",
"ringcentral/psr7": "^1.2"
},
"require-dev": {
"clue/block-react": "^1.0",
"clue/socks-react": "^0.8",
"phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35",
"react/http": "^0.8"
},
"type": "library",
"autoload": {
"psr-4": {
"Clue\\React\\Buzz\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@lueck.tv"
}
],
"description": "Simple, async PSR-7 HTTP client for concurrently processing any number of HTTP requests, built on top of ReactPHP",
"homepage": "https://github.com/clue/php-buzz-react",
"keywords": [
"async",
"http",
"http client",
"psr-7",
"reactphp"
],
"time": "2018-02-09T14:08:41+00:00"
},
{
"name": "clue/packagist-api-react",
"version": "v1.2.0",
"source": {
"type": "git",
"url": "https://github.com/clue/php-packagist-api-react.git",
"reference": "26608bdec979bde42b4563f881e8b12619bd247c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/clue/php-packagist-api-react/zipball/26608bdec979bde42b4563f881e8b12619bd247c",
"reference": "26608bdec979bde42b4563f881e8b12619bd247c",
"shasum": ""
},
"require": {
"clue/buzz-react": "^2.0 || ^1.0 || ^0.5",
"knplabs/packagist-api": "~1.0",
"php": ">=5.3",
"rize/uri-template": "^0.3"
},
"require-dev": {
"phpunit/phpunit": "^6.0 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"Clue\\React\\Packagist\\Api\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@lueck.tv"
}
],
"description": "Simple async access to packagist.org's API, like listing project details, number of downloads, etc.",
"homepage": "https://github.com/clue/php-packagist-api-react",
"keywords": [
"async",
"composer packages",
"packagist",
"reactphp"
],
"time": "2018-04-15T11:14:54+00:00"
},
{
"name": "doctrine/inflector",
"version": "v1.3.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/inflector.git",
"reference": "5527a48b7313d15261292c149e55e26eae771b0a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/inflector/zipball/5527a48b7313d15261292c149e55e26eae771b0a",
"reference": "5527a48b7313d15261292c149e55e26eae771b0a",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"phpunit/phpunit": "^6.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.3.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Inflector\\": "lib/Doctrine/Common/Inflector"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "Common String Manipulations with regard to casing and singular/plural rules.",
"homepage": "http://www.doctrine-project.org",
"keywords": [
"inflection",
"pluralize",
"singularize",
"string"
],
"time": "2018-01-09T20:05:19+00:00"
},
{
"name": "evenement/evenement",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/igorw/evenement.git",
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
"reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7",
"shasum": ""
},
"require": {
"php": ">=7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Evenement": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Igor Wiedler",
"email": "igor@wiedler.ch"
}
],
"description": "Événement is a very simple event dispatching library for PHP",
"keywords": [
"event-dispatcher",
"event-emitter"
],
"time": "2017-07-23T21:35:13+00:00"
},
{
"name": "guzzlehttp/guzzle",
"version": "6.3.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/407b0cb880ace85c9b63c5f9551db498cb2d50ba",
"reference": "407b0cb880ace85c9b63c5f9551db498cb2d50ba",
"shasum": ""
},
"require": {
"guzzlehttp/promises": "^1.0",
"guzzlehttp/psr7": "^1.4",
"php": ">=5.5"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0",
"psr/log": "^1.0"
},
"suggest": {
"psr/log": "Required for using the Log middleware"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.3-dev"
}
},
"autoload": {
"files": [
"src/functions_include.php"
],
"psr-4": {
"GuzzleHttp\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle is a PHP HTTP client library",
"homepage": "http://guzzlephp.org/",
"keywords": [
"client",
"curl",
"framework",
"http",
"http client",
"rest",
"web service"
],
"time": "2018-04-22T15:46:56+00:00"
},
{
"name": "guzzlehttp/promises",
"version": "v1.3.1",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646",
"reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646",
"shasum": ""
},
"require": {
"php": ">=5.5.0"
},
"require-dev": {
"phpunit/phpunit": "^4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "Guzzle promises library",
"keywords": [
"promise"
],
"time": "2016-12-20T10:07:11+00:00"
},
{
"name": "guzzlehttp/psr7",
"version": "1.4.2",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"shasum": ""
},
"require": {
"php": ">=5.4.0",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.4-dev"
}
},
"autoload": {
"psr-4": {
"GuzzleHttp\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
},
{
"name": "Tobias Schultze",
"homepage": "https://github.com/Tobion"
}
],
"description": "PSR-7 message implementation that also provides common utility methods",
"keywords": [
"http",
"message",
"request",
"response",
"stream",
"uri",
"url"
],
"time": "2017-03-20T17:10:46+00:00"
},
{
"name": "knplabs/packagist-api",
"version": "v1.5.1",
"source": {
"type": "git",
"url": "https://github.com/KnpLabs/packagist-api.git",
"reference": "74dbe93eab7cb80feb8fb9f2294f962d8d37fc71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/KnpLabs/packagist-api/zipball/74dbe93eab7cb80feb8fb9f2294f962d8d37fc71",
"reference": "74dbe93eab7cb80feb8fb9f2294f962d8d37fc71",
"shasum": ""
},
"require": {
"doctrine/inflector": "~1.0",
"guzzlehttp/guzzle": "~6.0",
"php": ">=5.5"
},
"require-dev": {
"phpspec/phpspec": "~2.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-0": {
"Packagist\\Api\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "KnpLabs Team",
"homepage": "http://knplabs.com"
}
],
"description": "Packagist API client.",
"homepage": "http://knplabs.com",
"keywords": [
"api",
"composer",
"packagist"
],
"time": "2018-01-19T08:15:53+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "react/cache",
"version": "v0.5.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/cache.git",
"reference": "7d7da7fb7574d471904ba357b39bbf110ccdbf66"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/cache/zipball/7d7da7fb7574d471904ba357b39bbf110ccdbf66",
"reference": "7d7da7fb7574d471904ba357b39bbf110ccdbf66",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"react/promise": "~2.0|~1.1"
},
"require-dev": {
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Cache\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Async, Promise-based cache interface for ReactPHP",
"keywords": [
"cache",
"caching",
"promise",
"reactphp"
],
"time": "2018-06-25T12:52:40+00:00"
},
{
"name": "react/dns",
"version": "v0.4.15",
"source": {
"type": "git",
"url": "https://github.com/reactphp/dns.git",
"reference": "319e110a436d26a2fa137cfa3ef2063951715794"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/dns/zipball/319e110a436d26a2fa137cfa3ef2063951715794",
"reference": "319e110a436d26a2fa137cfa3ef2063951715794",
"shasum": ""
},
"require": {
"php": ">=5.3.0",
"react/cache": "^0.5 || ^0.4 || ^0.3",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5",
"react/promise": "^2.1 || ^1.2.1",
"react/promise-timer": "^1.2",
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4.5"
},
"require-dev": {
"clue/block-react": "^1.2",
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Dns\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Async DNS resolver for ReactPHP",
"keywords": [
"async",
"dns",
"dns-resolver",
"reactphp"
],
"time": "2018-07-02T12:17:56+00:00"
},
{
"name": "react/event-loop",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/event-loop.git",
"reference": "0266aff7aa7b0613b1f38a723e14a0ebc55cfca3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/0266aff7aa7b0613b1f38a723e14a0ebc55cfca3",
"reference": "0266aff7aa7b0613b1f38a723e14a0ebc55cfca3",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8.35 || ^5.7 || ^6.4"
},
"suggest": {
"ext-event": "~1.0 for ExtEventLoop",
"ext-pcntl": "For signal handling support when using the StreamSelectLoop"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\EventLoop\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.",
"keywords": [
"asynchronous",
"event-loop"
],
"time": "2018-07-11T14:37:46+00:00"
},
{
"name": "react/http",
"version": "v0.8.3",
"source": {
"type": "git",
"url": "https://github.com/reactphp/http.git",
"reference": "f8bcdab2dc0ecd94f35ff9657a263028b96f0c46"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/http/zipball/f8bcdab2dc0ecd94f35ff9657a263028b96f0c46",
"reference": "f8bcdab2dc0ecd94f35ff9657a263028b96f0c46",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.0",
"react/promise": "^2.3 || ^1.2.1",
"react/promise-stream": "^1.1",
"react/socket": "^1.0 || ^0.8.3",
"react/stream": "^1.0 || ^0.7.1",
"ringcentral/psr7": "^1.2"
},
"require-dev": {
"clue/block-react": "^1.1",
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Http\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Event-driven, streaming plaintext HTTP and secure HTTPS server for ReactPHP",
"keywords": [
"event-driven",
"http",
"https",
"reactphp",
"server",
"streaming"
],
"time": "2018-04-11T15:03:27+00:00"
},
{
"name": "react/http-client",
"version": "v0.5.9",
"source": {
"type": "git",
"url": "https://github.com/reactphp/http-client.git",
"reference": "f8e81a022b61938e0b37c94c6351fc170b7d87f6"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/http-client/zipball/f8e81a022b61938e0b37c94c6351fc170b7d87f6",
"reference": "f8e81a022b61938e0b37c94c6351fc170b7d87f6",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.0",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/promise": "^2.1 || ^1.2.1",
"react/socket": "^1.0 || ^0.8.4",
"react/stream": "^1.0 || ^0.7.1",
"ringcentral/psr7": "^1.2"
},
"require-dev": {
"clue/block-react": "^1.2",
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35",
"react/promise-stream": "^1.1"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\HttpClient\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Event-driven, streaming HTTP client for ReactPHP",
"keywords": [
"http"
],
"time": "2018-04-10T11:38:54+00:00"
},
{
"name": "react/promise",
"version": "v2.7.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise.git",
"reference": "f4edc2581617431aea50430749db55cc3fc031b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise/zipball/f4edc2581617431aea50430749db55cc3fc031b3",
"reference": "f4edc2581617431aea50430749db55cc3fc031b3",
"shasum": ""
},
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Promise\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Jan Sorgalla",
"email": "jsorgalla@gmail.com"
}
],
"description": "A lightweight implementation of CommonJS Promises/A for PHP",
"keywords": [
"promise",
"promises"
],
"time": "2018-06-13T15:59:06+00:00"
},
{
"name": "react/promise-stream",
"version": "v1.1.1",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise-stream.git",
"reference": "00e269d611e9c9a29356aef64c07f7e513e73dc9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise-stream/zipball/00e269d611e9c9a29356aef64c07f7e513e73dc9",
"reference": "00e269d611e9c9a29356aef64c07f7e513e73dc9",
"shasum": ""
},
"require": {
"php": ">=5.3",
"react/promise": "^2.1 || ^1.2",
"react/stream": "^1.0 || ^0.7 || ^0.6 || ^0.5 || ^0.4 || ^0.3"
},
"require-dev": {
"clue/block-react": "^1.0",
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3",
"react/promise-timer": "^1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Promise\\Stream\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@lueck.tv"
}
],
"description": "The missing link between Promise-land and Stream-land for ReactPHP",
"homepage": "https://github.com/reactphp/promise-stream",
"keywords": [
"Buffer",
"async",
"promise",
"reactphp",
"stream",
"unwrap"
],
"time": "2017-12-22T12:02:05+00:00"
},
{
"name": "react/promise-timer",
"version": "v1.5.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/promise-timer.git",
"reference": "a11206938ca2394dc7bb368f5da25cd4533fa603"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/promise-timer/zipball/a11206938ca2394dc7bb368f5da25cd4533fa603",
"reference": "a11206938ca2394dc7bb368f5da25cd4533fa603",
"shasum": ""
},
"require": {
"php": ">=5.3",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5",
"react/promise": "^2.7.0 || ^1.2.1"
},
"require-dev": {
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Promise\\Timer\\": "src/"
},
"files": [
"src/functions.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Christian Lück",
"email": "christian@lueck.tv"
}
],
"description": "A trivial implementation of timeouts for Promises, built on top of ReactPHP.",
"homepage": "https://github.com/reactphp/promise-timer",
"keywords": [
"async",
"event-loop",
"promise",
"reactphp",
"timeout",
"timer"
],
"time": "2018-06-13T16:45:37+00:00"
},
{
"name": "react/socket",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/socket.git",
"reference": "476e2644a634c6301b8111e6d22a61679e6e6bd0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/socket/zipball/476e2644a634c6301b8111e6d22a61679e6e6bd0",
"reference": "476e2644a634c6301b8111e6d22a61679e6e6bd0",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.0",
"react/dns": "^0.4.13",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5",
"react/promise": "^2.6.0 || ^1.2.1",
"react/promise-timer": "^1.4.0",
"react/stream": "^1.0 || ^0.7.1"
},
"require-dev": {
"clue/block-react": "^1.2",
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Socket\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP",
"keywords": [
"Connection",
"Socket",
"async",
"reactphp",
"stream"
],
"time": "2018-07-11T14:38:22+00:00"
},
{
"name": "react/stream",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/reactphp/stream.git",
"reference": "fdd0140f42805d65bf9687636503db0b326d2244"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/stream/zipball/fdd0140f42805d65bf9687636503db0b326d2244",
"reference": "fdd0140f42805d65bf9687636503db0b326d2244",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.8",
"react/event-loop": "^1.0 || ^0.5 || ^0.4 || ^0.3.5"
},
"require-dev": {
"clue/stream-filter": "~1.2",
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\Stream\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP",
"keywords": [
"event-driven",
"io",
"non-blocking",
"pipe",
"reactphp",
"readable",
"stream",
"writable"
],
"time": "2018-07-11T14:38:16+00:00"
},
{
"name": "ringcentral/psr7",
"version": "1.2.2",
"source": {
"type": "git",
"url": "https://github.com/ringcentral/psr7.git",
"reference": "dcd84bbb49b96c616d1dcc8bfb9bef3f2cd53d1c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ringcentral/psr7/zipball/dcd84bbb49b96c616d1dcc8bfb9bef3f2cd53d1c",
"reference": "dcd84bbb49b96c616d1dcc8bfb9bef3f2cd53d1c",
"shasum": ""
},
"require": {
"php": ">=5.3",
"psr/http-message": "~1.0"
},
"provide": {
"psr/http-message-implementation": "1.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"psr-4": {
"RingCentral\\Psr7\\": "src/"
},
"files": [
"src/functions_include.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Michael Dowling",
"email": "mtdowling@gmail.com",
"homepage": "https://github.com/mtdowling"
}
],
"description": "PSR-7 message implementation",
"keywords": [
"http",
"message",
"stream",
"uri"
],
"time": "2018-01-15T21:00:49+00:00"
},
{
"name": "rize/uri-template",
"version": "0.3.2",
"source": {
"type": "git",
"url": "https://github.com/rize/UriTemplate.git",
"reference": "9e5fdd5c47147aa5adf7f760002ee591ed37b9ca"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/rize/UriTemplate/zipball/9e5fdd5c47147aa5adf7f760002ee591ed37b9ca",
"reference": "9e5fdd5c47147aa5adf7f760002ee591ed37b9ca",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.0.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Rize\\UriTemplate": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marut K",
"homepage": "http://twitter.com/rezigned"
}
],
"description": "PHP URI Template (RFC 6570) supports both expansion & extraction",
"keywords": [
"RFC 6570",
"template",
"uri"
],
"time": "2017-06-14T03:57:53+00:00"
}
],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": [],
"platform-dev": []
}
<?php
use Psr\Http\Message\ServerRequestInterface;
use React\Http\Response;
use React\Stream\ThroughStream;
use React\Socket\ConnectionInterface;
require __DIR__ . '/vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$fun = function ($request) {
//$db = new Db();
$promise = $db->query('select * from user');
return $promise->then(function ($users) {
$users = json_encode($users);
return new Response(200, [], $users);
});
};
$chat = new ThroughStream();
$loop->addPeriodicTimer(1, function () use ($chat) {
$chat->write(microtime(true));
});
$socket = new React\Socket\Server('0.0.0.0:8081', $loop);
$socket->on('connection', function (ConnectionInterface $conn) use ($chat) {
$conn->on('data', function ($chunk) use ($chat) {
$chat->write($chunk);
});
});
$sse = new ThroughStream(function ($data) {
return 'data: ' . $data . PHP_EOL . PHP_EOL;
});
$chat->pipe($sse);
$server = new React\Http\Server(function (ServerRequestInterface $request) use ($sse) {
if ($request->getUri()->getPath() === '/') {
return new Response(200, ['text/html'], <<<HTML
<html>
<body>
<script>
var eventsource = new EventSource("/stream");
eventsource.addEventListener("message", function(message) {
//console.log(message);
document.body.innerHTML += message.data + "<br />";
});
</script>
Hello world!
</body>
</html>
HTML
);
}
$body = new ThroughStream();
$sse->pipe($body);
if ($request->getUri()->getPath() === '/stream') {
return new Response(
200,
['Content-Type' => 'text/event-stream'],
$body
);
}
});
$socket = new React\Socket\Server('0.0.0.0:8080', $loop);
$server->listen($socket);
$loop->run();
<?php
use React\Socket\ConnectionInterface;
require __DIR__ . '/vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$connector = new \React\Socket\Connector($loop);
$browser = new Clue\React\Buzz\Browser($loop);
for ($i = 0; $i < 1; ++$i) {
$promise = $browser->post('http://github.com/');
$promise->then(function (Psr\Http\Message\ResponseInterface $response) {
//var_dump($response->getHeaders());
if ($response->getStatusCode() !== 200) {
}
echo $response->getBody() . PHP_EOL;
});
}
//$out = new \React\Stream\WritableResourceStream(STDOUT, $loop);
//$stream = new \React\Stream\ReadableResourceStream(STDIN, $loop);
//$stream->on('data', function ($chunk) use ($out) {
// $out->write(strtoupper($chunk));
//});
//$stream->pipe($through)->pipe($out);
//$loop->addTimer(10, function () use ($timer, $loop) {
// $loop->cancelTimer($timer);
//});
$loop->run();
<?php
use Clue\React\Packagist\Api\Client;
require __DIR__ . '/vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$browser = new Clue\React\Buzz\Browser($loop);
$client = new Client($browser);
$promises = [
$client->get('clue/buzz-react'),
$client->get('clue/packagist-api-react')
];
$promise = \React\Promise\all($promises);
$promise->then(function (array $all) {
var_dump(count($all));
});
$loop->run();
<?php
use React\Socket\ConnectionInterface;
require __DIR__ . '/vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$connections = [];
$server = new React\Socket\Server('0.0.0.0:8080', $loop);
$server->on('connection', function (ConnectionInterface $conn) use (&$connections) {
//$conn->write('Hello ' . $conn->getRemoteAddress() . PHP_EOL);
$conn->on('data', function ($chunk) use ($conn) {
$conn->end("HTTP/1.0 200 OK\r\n\r\nHello world!");
});
});
$loop->run();
<?php
use Psr\Http\Message\ServerRequestInterface;
use React\Http\Response;
use React\Stream\ThroughStream;
require __DIR__ . '/vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$fun = function ($request) {
//$db = new Db();
$promise = $db->query('select * from user');
return $promise->then(function ($users) {
$users = json_encode($users);
return new Response(200, [], $users);
});
};
$server = new React\Http\Server(function (ServerRequestInterface $request) use ($loop) {
if ($request->getUri()->getPath() !== '/') {
return new Response(404, [], 'Not found!');
}
//throw new Exception();
$body = new ThroughStream();
$timer = $loop->addPeriodicTimer(0.1, function () use ($body) {
//$body->write('.');
$body->write(microtime(true) . PHP_EOL);
});
$loop->addTimer(5, function () use ($body, $loop, $timer) {
$loop->cancelTimer($timer);
$body->end();
});
return new Response(200, ['Content-Type' => 'text/plain'], $body);
});
$socket = new React\Socket\Server('0.0.0.0:8080', $loop);
$server->listen($socket);
$loop->run();
<?php
use React\Socket\ConnectionInterface;
require __DIR__ . '/vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$connector = new \React\Socket\Connector($loop);
for ($i = 0; $i < 1; ++$i) {
$promise = $connector->connect('localhost:8080');
$promise->then(function (ConnectionInterface $stream) {
//$resource = stream_socket_client('tcp://github.com:80');
//$stream = new \React\Stream\DuplexResourceStream($resource, $loop);
$stream->on('data', function ($chunk) {
echo $chunk;
});
$stream->write("GET / HTTP/1.0\r\n\r\n");
});
}
//$out = new \React\Stream\WritableResourceStream(STDOUT, $loop);
//$stream = new \React\Stream\ReadableResourceStream(STDIN, $loop);
//$stream->on('data', function ($chunk) use ($out) {
// $out->write(strtoupper($chunk));
//});
//$stream->pipe($through)->pipe($out);
//$loop->addTimer(10, function () use ($timer, $loop) {
// $loop->cancelTimer($timer);
//});
$loop->run();
<?php
require __DIR__ . '/vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$out = new \React\Stream\WritableResourceStream(STDOUT, $loop);
$stream = new \React\Stream\ReadableResourceStream(STDIN, $loop);
//$stream->on('data', function ($chunk) use ($out) {
// $out->write(strtoupper($chunk));
//});
$through = new \React\Stream\ThroughStream(function ($data) {
return strtoupper($data);
});
$stream->pipe($through)->pipe($out);
$stream->on('close', function () {
echo 'BYE!' . PHP_EOL;
});
//$loop->addTimer(10, function () use ($timer, $loop) {
// $loop->cancelTimer($timer);
//});
$loop->run();
<?php
require __DIR__ . '/vendor/autoload.php';
$loop = \React\EventLoop\Factory::create();
$timer = $loop->addPeriodicTimer(0.1, function () {
echo '.';
});
$loop->addTimer(10, function () use ($timer, $loop) {
$loop->cancelTimer($timer);
});
$loop->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment