commit dbdb7b7997b6d0b96ce03c5c911af13aa31d01db
parent 5d8306e6db301aea703186bfa11f06d4562b5e6e
Author: finwo <finwo@pm.me>
Date: Wed, 22 Feb 2017 11:29:09 +0100
HTTP working ; main dependencies selected
Diffstat:
4 files changed, 312 insertions(+), 3 deletions(-)
diff --git a/.gitignore b/.gitignore
@@ -1 +1,3 @@
.idea
+fifo.*
+/vendor/
diff --git a/composer.json b/composer.json
@@ -0,0 +1,17 @@
+{
+ "name": "finwo/php-framework-skeleton",
+ "require": {
+ "klein/klein": "^2.1",
+ "mustangostang/spyc": "^0.6.1",
+ "netresearch/jsonmapper": "^1.1",
+ "php-di/invoker": "^1.3"
+ },
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Robin Bron",
+ "email": "robin@finwo.nl"
+ }
+ ],
+ "minimum-stability": "stable"
+}
diff --git a/composer.lock b/composer.lock
@@ -0,0 +1,286 @@
+{
+ "_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": "1e29e1c8acf0013e2ec9a4212ff0acc8",
+ "packages": [
+ {
+ "name": "container-interop/container-interop",
+ "version": "1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/container-interop/container-interop.git",
+ "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8",
+ "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8",
+ "shasum": ""
+ },
+ "require": {
+ "psr/container": "^1.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Interop\\Container\\": "src/Interop/Container/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Promoting the interoperability of container objects (DIC, SL, etc.)",
+ "homepage": "https://github.com/container-interop/container-interop",
+ "time": "2017-02-14T19:40:03+00:00"
+ },
+ {
+ "name": "klein/klein",
+ "version": "v2.1.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/klein/klein.php.git",
+ "reference": "6549676cc831b9417332b3d9485c64bbf7bac728"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/klein/klein.php/zipball/6549676cc831b9417332b3d9485c64bbf7bac728",
+ "reference": "6549676cc831b9417332b3d9485c64bbf7bac728",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "require-dev": {
+ "phpunit/php-code-coverage": "^2.2",
+ "phpunit/phpunit": "^4.8",
+ "squizlabs/php_codesniffer": "1.4.8"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Klein\\": "src/Klein/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Chris O'Hara",
+ "email": "cohara87@gmail.com",
+ "homepage": "http://chris6f.com/",
+ "role": "Creator/Developer"
+ },
+ {
+ "name": "Trevor Suarez",
+ "email": "rican7@gmail.com",
+ "homepage": "https://trevorsuarez.com/",
+ "role": "Contributor/Developer"
+ }
+ ],
+ "description": "A lightning fast router for PHP",
+ "homepage": "https://github.com/klein/klein.php",
+ "keywords": [
+ "boilerplate",
+ "router",
+ "routing",
+ "sinatra"
+ ],
+ "time": "2017-02-01T23:08:58+00:00"
+ },
+ {
+ "name": "mustangostang/spyc",
+ "version": "0.6.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mustangostang/spyc.git",
+ "reference": "022532641d61d383fd3ae666982bd46e61e5915e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mustangostang/spyc/zipball/022532641d61d383fd3ae666982bd46e61e5915e",
+ "reference": "022532641d61d383fd3ae666982bd46e61e5915e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.3.*@dev"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "0.5.x-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "Spyc.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "mustangostang",
+ "email": "vlad.andersen@gmail.com"
+ }
+ ],
+ "description": "A simple YAML loader/dumper class for PHP",
+ "homepage": "https://github.com/mustangostang/spyc/",
+ "keywords": [
+ "spyc",
+ "yaml",
+ "yml"
+ ],
+ "time": "2016-10-21T00:03:34+00:00"
+ },
+ {
+ "name": "netresearch/jsonmapper",
+ "version": "v1.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/cweiske/jsonmapper.git",
+ "reference": "8d0b6d5b9f5940757b44bc0ee2f930aae6d4a6c7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/8d0b6d5b9f5940757b44bc0ee2f930aae6d4a6c7",
+ "reference": "8d0b6d5b9f5940757b44bc0ee2f930aae6d4a6c7",
+ "shasum": ""
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.2.*",
+ "squizlabs/php_codesniffer": "~1.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-0": {
+ "JsonMapper": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "OSL-3.0"
+ ],
+ "authors": [
+ {
+ "name": "Christian Weiske",
+ "email": "cweiske@cweiske.de",
+ "homepage": "http://github.com/cweiske/jsonmapper/",
+ "role": "Developer"
+ }
+ ],
+ "description": "Map nested JSON structures onto PHP classes",
+ "time": "2017-01-27T21:01:41+00:00"
+ },
+ {
+ "name": "php-di/invoker",
+ "version": "1.3.3",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PHP-DI/Invoker.git",
+ "reference": "1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7",
+ "reference": "1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7",
+ "shasum": ""
+ },
+ "require": {
+ "container-interop/container-interop": "~1.1"
+ },
+ "require-dev": {
+ "athletic/athletic": "~0.1.8",
+ "phpunit/phpunit": "~4.5"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Invoker\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Generic and extensible callable invoker",
+ "homepage": "https://github.com/PHP-DI/Invoker",
+ "keywords": [
+ "callable",
+ "dependency",
+ "dependency-injection",
+ "injection",
+ "invoke",
+ "invoker"
+ ],
+ "time": "2016-07-14T13:09:58+00:00"
+ },
+ {
+ "name": "psr/container",
+ "version": "1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/container.git",
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
+ "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Container\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "http://www.php-fig.org/"
+ }
+ ],
+ "description": "Common Container Interface (PHP FIG PSR-11)",
+ "homepage": "https://github.com/php-fig/container",
+ "keywords": [
+ "PSR-11",
+ "container",
+ "container-interface",
+ "container-interop",
+ "psr"
+ ],
+ "time": "2017-02-14T16:28:37+00:00"
+ }
+ ],
+ "packages-dev": [],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": [],
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": [],
+ "platform-dev": []
+}
diff --git a/run.sh b/run.sh
@@ -1,10 +1,14 @@
#!/usr/bin/env bash
-XRARGS= -x -v -s http:0.0.0.0:$PORT
+XRARGS="-x -s http:0.0.0.0:$PORT"
+rm fifo.* 2>/dev/null
for i in {0..9} ; do
- XRARGS="$XARGS -b 127.0.0.1:800$i"
- while true ; do FIFO=$(hexdump -n 16 -v -e '/1 "%02X"' -e '/16 "\n"' /dev/urandom) ; mkfifo fifo.$FIFO ; nc -l 800$i < fifo.$FIFO | php sgi.php > fifo.$FIFO ; rm fifo.$FIFO ; done &
+ XRARGS="$XRARGS -b 127.0.0.1:800$i"
+ echo Starting handler: 800$i
+ { while true ; do FIFO=$(hexdump -n 16 -v -e '/1 "%02X"' -e '/16 "\n"' /dev/urandom) ; mkfifo fifo.$FIFO ; nc -l 800$i < fifo.$FIFO | php init.php > fifo.$FIFO ; rm fifo.$FIFO ; done } &
done;
+echo Starting load-balancer on $PORT
+echo xr $XRARGS
xr $XRARGS