├── .dockerignore ├── .editorconfig ├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── aws-lambda-rie ├── create-function-screenshot.gif ├── docker-compose.yml ├── docker-entrypoint.sh ├── example ├── .dockerignore ├── Dockerfile ├── aws-lambda-rie ├── composer.json ├── composer.lock ├── docker-compose.yml └── index.php ├── test.http └── var ├── runtime ├── bootstrap ├── composer.json ├── composer.lock └── lib │ └── API.php └── task └── index.php /.dockerignore: -------------------------------------------------------------------------------- 1 | ** 2 | !/var/** 3 | /var/runtime/vendor/ 4 | !docker-entrypoint.sh 5 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | max_line_length = 120 10 | tab_width = 4 11 | trim_trailing_whitespace = true 12 | 13 | [{*.yaml,*.yml}] 14 | indent_size = 2 15 | tab_width = 2 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vendor/ 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM phpswoole/swoole:4.6-php8.0-alpine 2 | COPY /var /var 3 | RUN cd /var/runtime && composer install --prefer-dist --no-dev -o 4 | WORKDIR /var/task 5 | COPY ./docker-entrypoint.sh /docker-entrypoint.sh 6 | ENTRYPOINT [ "/docker-entrypoint.sh" ] 7 | CMD [ "index" ] 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Leo Cavalcante 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # λ Swoole Runtime for AWS Lambda 2 | 3 | Run PHP Coroutines & Fibers as-a-Service on the AWS Lambda. 4 | 5 | ## Getting started 6 | 7 | ### Create your Lambda function 8 | 9 | #### index.php 10 | ```php 11 | push("{$context['greet']}!"); 26 | }); 27 | 28 | Coroutine::create(static function() use ($channel): void { 29 | Coroutine::sleep(0.5); 30 | $channel->push('Hello'); 31 | }); 32 | 33 | return implode(', ', [$channel->pop(), $channel->pop()]); 34 | } 35 | ``` 36 | The `main(array $context)` function here **is not optional**, the runtime will make a call to a `main` function passing a `array` representing the context. 37 | The return should be something scalar or a `JsonSerializable` object. 38 | 39 | #### Dockerfile 40 | ```Dockerfile 41 | FROM leocavalcante/aws-lambda-swoole-runtime 42 | # The WORKDIR is already /var/task 43 | COPY composer.* . 44 | RUN composer install -o --prefer-dist --no-dev 45 | # This split avoids a call to composer install on every change to a source-code file 46 | COPY . . 47 | ``` 48 | 49 | ### Testing locally 50 | 51 | To test AWS Lambda functions based on Container images locally, Amazon provides the [AWS Lambda Runtime Interface Emulator (RIE)](https://docs.aws.amazon.com/lambda/latest/dg/images-test.html). 52 | 53 | > It is a proxy for the Lambda Runtime API that allows you to locally test your Lambda function packaged as a container image. The emulator is a lightweight web server that converts HTTP requests into JSON events to pass to the Lambda function in the container image. 54 | 55 | #### Build the image 56 | ```bash 57 | docker build -t my-aws-lambda-function . 58 | ``` 59 | Also grab the `8080` port on the container, it will be where the emulator will bind to. 60 | 61 | #### Run using the RIE as Entrypoint 62 | ```bash 63 | docker run --rm -v "$(pwd)/aws-lambda-rie:/aws-lambda-rie" --entrypoint /aws-lambda-rie -p 9000:8080 my-aws-lambda-function 64 | ``` 65 | 66 | #### Make a POST request 67 | ```http request 68 | POST http://localhost:9000/2015-03-31/functions/function/invocations 69 | Content-Type: application/json 70 | 71 | {"greet": "Swoole"} 72 | ``` 73 | 74 | Or: 75 | ```bash 76 | curl -XPOST http://localhost:9000/2015-03-31/functions/function/invocations -d '{"greet": "Swoole"}' 77 | ``` 78 | 79 | You should be seeing: 80 | 81 | ```http reponse 82 | HTTP/1.1 200 OK 83 | Date: Fri, 19 Mar 2021 17:44:58 GMT 84 | Content-Length: 16 85 | Content-Type: text/plain; charset=utf-8 86 | 87 | "Hello, Swoole!" 88 | ``` 89 | 90 | ### Deploying to production 91 | 92 | #### 1. Login to your ECR 93 | ```bash 94 | aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 884320951759.dkr.ecr.us-east-1.amazonaws.com 95 | ``` 96 | Don't forget to change region `us-east-1` and the AWS Account ID (`884320951759`). 97 | 98 | > It assumes that you already have the [AWS Command Line Interface (`aws`)](https://aws.amazon.com/cli/) and it is [already configured (`aws configure`)](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html). **And yes, a Private ECR already created.** 99 | 100 | ⚠️ Also make sure that you will be using a Private ECR on the same Account that your Lambda function. 101 | 102 | #### 2. Build and push your image 103 | ```bash 104 | docker build -t 884320951759.dkr.ecr.us-east-1.amazonaws.com/lambda-swoole-runtime-example . 105 | docker push 884320951759.dkr.ecr.us-east-1.amazonaws.com/lambda-swoole-runtime-example 106 | ``` 107 | 108 | #### 3. Your Swoole-powered AWS Lambda Container image is ready! 109 | 110 | You can use the Web UI to create a **Function** based on it: 111 | 112 | ![Create function screenshot](create-function-screenshot.gif) 113 | 114 | --- 115 |

116 | MIT License
117 | Copyright (c) 2021 Leo Cavalcante 118 |

119 | -------------------------------------------------------------------------------- /aws-lambda-rie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leocavalcante/aws-lambda-swoole-runtime/cf548d3fe77fa06c3c10719799da0673567a1cf7/aws-lambda-rie -------------------------------------------------------------------------------- /create-function-screenshot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leocavalcante/aws-lambda-swoole-runtime/cf548d3fe77fa06c3c10719799da0673567a1cf7/create-function-screenshot.gif -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | lambda: 3 | build: . 4 | volumes: 5 | - ./aws-lambda-rie:/aws-lambda-rie 6 | - ./var/runtime/:/var/runtime/ 7 | - ./var/task/:/var/task/ 8 | entrypoint: 9 | - /aws-lambda-rie 10 | ports: 11 | - 9000:8080 12 | 13 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | 4 | if [ $# -ne 1 ]; then 5 | echo "entrypoint requires the handler name to be the first argument" 1>&2 6 | exit 142 7 | fi 8 | export _HANDLER="$1" 9 | 10 | exec /var/runtime/bootstrap 11 | -------------------------------------------------------------------------------- /example/.dockerignore: -------------------------------------------------------------------------------- 1 | vendor/** 2 | -------------------------------------------------------------------------------- /example/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM leocavalcante/aws-lambda-swoole-runtime 2 | # The WORKDIR is already /var/task 3 | COPY composer.* . 4 | RUN composer install -o --prefer-dist --no-dev 5 | # This split avoids a call to composer install on every change to a source-code file 6 | COPY . . 7 | -------------------------------------------------------------------------------- /example/aws-lambda-rie: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/leocavalcante/aws-lambda-swoole-runtime/cf548d3fe77fa06c3c10719799da0673567a1cf7/example/aws-lambda-rie -------------------------------------------------------------------------------- /example/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "leocavalcante/aws-lambda-swoole-runtime-example", 3 | "description": "A Swoole runtime example for AWS Lambda", 4 | "type": "project", 5 | "require-dev": { 6 | "swoole/ide-helper": "^4.6" 7 | }, 8 | "license": "MIT", 9 | "authors": [ 10 | { 11 | "name": "leocavalcante", 12 | "email": "lc@leocavalcante.com" 13 | } 14 | ], 15 | "minimum-stability": "stable", 16 | "require": {} 17 | } 18 | -------------------------------------------------------------------------------- /example/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "29327a4f13884ac86cc1f306daee0982", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "swoole/ide-helper", 12 | "version": "4.6.4", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/swoole/ide-helper.git", 16 | "reference": "7e5c51ce7cc8c03ffb836aad31f3f27cd871aa96" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/swoole/ide-helper/zipball/7e5c51ce7cc8c03ffb836aad31f3f27cd871aa96", 21 | "reference": "7e5c51ce7cc8c03ffb836aad31f3f27cd871aa96", 22 | "shasum": "" 23 | }, 24 | "require-dev": { 25 | "guzzlehttp/guzzle": "~6.5.0", 26 | "laminas/laminas-code": "~3.4.0", 27 | "squizlabs/php_codesniffer": "~3.5.0", 28 | "symfony/filesystem": "~4.0" 29 | }, 30 | "type": "library", 31 | "notification-url": "https://packagist.org/downloads/", 32 | "license": [ 33 | "Apache-2.0" 34 | ], 35 | "authors": [ 36 | { 37 | "name": "Team Swoole", 38 | "email": "team@swoole.com" 39 | } 40 | ], 41 | "description": "IDE help files for Swoole.", 42 | "support": { 43 | "issues": "https://github.com/swoole/ide-helper/issues", 44 | "source": "https://github.com/swoole/ide-helper/tree/4.6.4" 45 | }, 46 | "time": "2021-03-11T19:44:34+00:00" 47 | } 48 | ], 49 | "aliases": [], 50 | "minimum-stability": "stable", 51 | "stability-flags": [], 52 | "prefer-stable": false, 53 | "prefer-lowest": false, 54 | "platform": [], 55 | "platform-dev": [], 56 | "plugin-api-version": "2.0.0" 57 | } 58 | -------------------------------------------------------------------------------- /example/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | example: 3 | build: . 4 | volumes: 5 | - ./:/var/task/ 6 | - ./aws-lambda-rie:/aws-lambda-rie 7 | entrypoint: 8 | - /aws-lambda-rie 9 | ports: 10 | - 9000:8080 11 | 12 | -------------------------------------------------------------------------------- /example/index.php: -------------------------------------------------------------------------------- 1 | push("{$context['greet']}!"); 13 | }); 14 | 15 | Coroutine::create(static function() use ($channel): void { 16 | Coroutine::sleep(0.5); 17 | $channel->push('Hello'); 18 | }); 19 | 20 | return implode(', ', [$channel->pop(), $channel->pop()]); 21 | } 22 | -------------------------------------------------------------------------------- /test.http: -------------------------------------------------------------------------------- 1 | POST http://localhost:9000/2015-03-31/functions/function/invocations 2 | Content-Type: application/json 3 | 4 | {"greet": "Swoole"} 5 | -------------------------------------------------------------------------------- /var/runtime/bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/php 2 | response(main($api->next())); 15 | } catch (\Throwable $err) { 16 | $api->error($err); 17 | } 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /var/runtime/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "leocavalcante/aws-lambda-swoole-runtime", 3 | "description": "A Swoole runtime for AWS Lambda", 4 | "type": "project", 5 | "license": "MIT", 6 | "authors": [ 7 | { 8 | "name": "leocavalcante", 9 | "email": "lc@leocavalcante.com" 10 | } 11 | ], 12 | "minimum-stability": "stable", 13 | "require-dev": { 14 | "roave/security-advisories": "dev-master", 15 | "swoole/ide-helper": "^4.6" 16 | }, 17 | "autoload": { 18 | "psr-4": { 19 | "Runtime\\": "lib/" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /var/runtime/composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "0f204ce01308931c39e938ea0f96daf6", 8 | "packages": [], 9 | "packages-dev": [ 10 | { 11 | "name": "roave/security-advisories", 12 | "version": "dev-master", 13 | "source": { 14 | "type": "git", 15 | "url": "https://github.com/Roave/SecurityAdvisories.git", 16 | "reference": "fe6ef201f838f07770873731a99f359ebb64fa50" 17 | }, 18 | "dist": { 19 | "type": "zip", 20 | "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/fe6ef201f838f07770873731a99f359ebb64fa50", 21 | "reference": "fe6ef201f838f07770873731a99f359ebb64fa50", 22 | "shasum": "" 23 | }, 24 | "conflict": { 25 | "3f/pygmentize": "<1.2", 26 | "adodb/adodb-php": "<5.20.12", 27 | "alterphp/easyadmin-extension-bundle": ">=1.2,<1.2.11|>=1.3,<1.3.1", 28 | "amphp/artax": "<1.0.6|>=2,<2.0.6", 29 | "amphp/http": "<1.0.1", 30 | "amphp/http-client": ">=4,<4.4", 31 | "api-platform/core": ">=2.2,<2.2.10|>=2.3,<2.3.6", 32 | "asymmetricrypt/asymmetricrypt": ">=0,<9.9.99", 33 | "aws/aws-sdk-php": ">=3,<3.2.1", 34 | "bagisto/bagisto": "<0.1.5", 35 | "barrelstrength/sprout-base-email": "<1.2.7", 36 | "barrelstrength/sprout-forms": "<3.9", 37 | "baserproject/basercms": ">=4,<=4.3.6|>=4.4,<4.4.1", 38 | "bolt/bolt": "<3.7.1", 39 | "bolt/core": "<4.1.13", 40 | "brightlocal/phpwhois": "<=4.2.5", 41 | "buddypress/buddypress": "<5.1.2", 42 | "bugsnag/bugsnag-laravel": ">=2,<2.0.2", 43 | "cakephp/cakephp": ">=1.3,<1.3.18|>=2,<2.4.99|>=2.5,<2.5.99|>=2.6,<2.6.12|>=2.7,<2.7.6|>=3,<3.5.18|>=3.6,<3.6.15|>=3.7,<3.7.7", 44 | "cart2quote/module-quotation": ">=4.1.6,<=4.4.5|>=5,<5.4.4", 45 | "cartalyst/sentry": "<=2.1.6", 46 | "centreon/centreon": "<18.10.8|>=19,<19.4.5", 47 | "cesnet/simplesamlphp-module-proxystatistics": "<3.1", 48 | "codeigniter/framework": "<=3.0.6", 49 | "composer/composer": "<=1-alpha.11", 50 | "contao-components/mediaelement": ">=2.14.2,<2.21.1", 51 | "contao/core": ">=2,<3.5.39", 52 | "contao/core-bundle": ">=4,<4.4.52|>=4.5,<4.9.6|= 4.10.0", 53 | "contao/listing-bundle": ">=4,<4.4.8", 54 | "datadog/dd-trace": ">=0.30,<0.30.2", 55 | "david-garcia/phpwhois": "<=4.3.1", 56 | "derhansen/sf_event_mgt": "<4.3.1|>=5,<5.1.1", 57 | "doctrine/annotations": ">=1,<1.2.7", 58 | "doctrine/cache": ">=1,<1.3.2|>=1.4,<1.4.2", 59 | "doctrine/common": ">=2,<2.4.3|>=2.5,<2.5.1", 60 | "doctrine/dbal": ">=2,<2.0.8|>=2.1,<2.1.2", 61 | "doctrine/doctrine-bundle": "<1.5.2", 62 | "doctrine/doctrine-module": "<=0.7.1", 63 | "doctrine/mongodb-odm": ">=1,<1.0.2", 64 | "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", 65 | "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", 66 | "dolibarr/dolibarr": "<11.0.4", 67 | "dompdf/dompdf": ">=0.6,<0.6.2", 68 | "drupal/core": ">=7,<7.74|>=8,<8.8.11|>=8.9,<8.9.9|>=9,<9.0.8", 69 | "drupal/drupal": ">=7,<7.74|>=8,<8.8.11|>=8.9,<8.9.9|>=9,<9.0.8", 70 | "endroid/qr-code-bundle": "<3.4.2", 71 | "enshrined/svg-sanitize": "<0.13.1", 72 | "erusev/parsedown": "<1.7.2", 73 | "ezsystems/demobundle": ">=5.4,<5.4.6.1", 74 | "ezsystems/ez-support-tools": ">=2.2,<2.2.3", 75 | "ezsystems/ezdemo-ls-extension": ">=5.4,<5.4.2.1", 76 | "ezsystems/ezfind-ls": ">=5.3,<5.3.6.1|>=5.4,<5.4.11.1|>=2017.12,<2017.12.0.1", 77 | "ezsystems/ezplatform": ">=1.7,<1.7.9.1|>=1.13,<1.13.5.1|>=2.5,<2.5.4", 78 | "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6", 79 | "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1", 80 | "ezsystems/ezplatform-kernel": ">=1,<1.0.2.1", 81 | "ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<=1.3.1", 82 | "ezsystems/ezplatform-user": ">=1,<1.0.1", 83 | "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.14.2|>=6,<6.7.9.1|>=6.8,<=6.13.8|>=7,<7.2.4.1|>=7.3,<7.3.2.1|>=7.5,<=7.5.15", 84 | "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.14.2|>=2011,<2017.12.7.3|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3|>=2019.3,<2019.3.5.1", 85 | "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", 86 | "ezsystems/repository-forms": ">=2.3,<2.3.2.1", 87 | "ezyang/htmlpurifier": "<4.1.1", 88 | "facade/ignition": "<=2.5.1,>=2.0|<=1.16.13", 89 | "firebase/php-jwt": "<2", 90 | "flarum/sticky": ">=0.1-beta.14,<=0.1-beta.15", 91 | "flarum/tags": "<=0.1-beta.13", 92 | "fooman/tcpdf": "<6.2.22", 93 | "fossar/tcpdf-parser": "<6.2.22", 94 | "friendsofsymfony/oauth2-php": "<1.3", 95 | "friendsofsymfony/rest-bundle": ">=1.2,<1.2.2", 96 | "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", 97 | "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", 98 | "fuel/core": "<1.8.1", 99 | "getgrav/grav": "<1.7-beta.8", 100 | "getkirby/cms": ">=3,<3.4.5", 101 | "getkirby/panel": "<2.5.14", 102 | "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", 103 | "gree/jose": "<=2.2", 104 | "gregwar/rst": "<1.0.3", 105 | "guzzlehttp/guzzle": ">=4-rc.2,<4.2.4|>=5,<5.3.1|>=6,<6.2.1", 106 | "illuminate/auth": ">=4,<4.0.99|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.10", 107 | "illuminate/cookie": ">=4,<=4.0.11|>=4.1,<=4.1.99999|>=4.2,<=4.2.99999|>=5,<=5.0.99999|>=5.1,<=5.1.99999|>=5.2,<=5.2.99999|>=5.3,<=5.3.99999|>=5.4,<=5.4.99999|>=5.5,<=5.5.49|>=5.6,<=5.6.99999|>=5.7,<=5.7.99999|>=5.8,<=5.8.99999|>=6,<6.18.31|>=7,<7.22.4", 108 | "illuminate/database": "<6.20.14|>=7,<7.30.4|>=8,<8.24", 109 | "illuminate/encryption": ">=4,<=4.0.11|>=4.1,<=4.1.31|>=4.2,<=4.2.22|>=5,<=5.0.35|>=5.1,<=5.1.46|>=5.2,<=5.2.45|>=5.3,<=5.3.31|>=5.4,<=5.4.36|>=5.5,<5.5.40|>=5.6,<5.6.15", 110 | "illuminate/view": ">=7,<7.1.2", 111 | "impresscms/impresscms": "<=1.4.2", 112 | "ivankristianto/phpwhois": "<=4.3", 113 | "james-heinrich/getid3": "<1.9.9", 114 | "joomla/archive": "<1.1.10", 115 | "joomla/session": "<1.3.1", 116 | "jsmitty12/phpwhois": "<5.1", 117 | "kazist/phpwhois": "<=4.2.6", 118 | "kitodo/presentation": "<3.1.2", 119 | "kreait/firebase-php": ">=3.2,<3.8.1", 120 | "la-haute-societe/tcpdf": "<6.2.22", 121 | "laravel/framework": "<6.20.14|>=7,<7.30.4|>=8,<8.24", 122 | "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", 123 | "league/commonmark": "<0.18.3", 124 | "librenms/librenms": "<1.53", 125 | "livewire/livewire": ">2.2.4,<2.2.6", 126 | "magento/community-edition": ">=2,<2.2.10|>=2.3,<2.3.3", 127 | "magento/magento1ce": "<1.9.4.3", 128 | "magento/magento1ee": ">=1,<1.14.4.3", 129 | "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", 130 | "marcwillmann/turn": "<0.3.3", 131 | "mautic/core": "<2.16.5|>=3,<3.2.4|= 2.13.1", 132 | "mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35", 133 | "mittwald/typo3_forum": "<1.2.1", 134 | "monolog/monolog": ">=1.8,<1.12", 135 | "namshi/jose": "<2.2", 136 | "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", 137 | "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", 138 | "nystudio107/craft-seomatic": "<3.3", 139 | "nzo/url-encryptor-bundle": ">=4,<4.3.2|>=5,<5.0.1", 140 | "october/backend": "<1.1.2", 141 | "october/cms": "= 1.0.469|>=1.0.319,<1.0.469", 142 | "october/october": ">=1.0.319,<1.0.466", 143 | "october/rain": "<1.0.472|>=1.1,<1.1.2", 144 | "onelogin/php-saml": "<2.10.4", 145 | "oneup/uploader-bundle": "<1.9.3|>=2,<2.1.5", 146 | "openid/php-openid": "<2.3", 147 | "openmage/magento-lts": "<19.4.8|>=20,<20.0.4", 148 | "orchid/platform": ">=9,<9.4.4", 149 | "oro/crm": ">=1.7,<1.7.4", 150 | "oro/platform": ">=1.7,<1.7.4", 151 | "padraic/humbug_get_contents": "<1.1.2", 152 | "pagarme/pagarme-php": ">=0,<3", 153 | "paragonie/random_compat": "<2", 154 | "passbolt/passbolt_api": "<2.11", 155 | "paypal/merchant-sdk-php": "<3.12", 156 | "pear/archive_tar": "<1.4.12", 157 | "personnummer/personnummer": "<3.0.2", 158 | "phpfastcache/phpfastcache": ">=5,<5.0.13", 159 | "phpmailer/phpmailer": "<6.1.6", 160 | "phpmussel/phpmussel": ">=1,<1.6", 161 | "phpmyadmin/phpmyadmin": "<4.9.6|>=5,<5.0.3", 162 | "phpoffice/phpexcel": "<1.8.2", 163 | "phpoffice/phpspreadsheet": "<1.16", 164 | "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", 165 | "phpwhois/phpwhois": "<=4.2.5", 166 | "phpxmlrpc/extras": "<0.6.1", 167 | "pimcore/pimcore": "<6.8.8", 168 | "pocketmine/pocketmine-mp": "<3.15.4", 169 | "prestashop/autoupgrade": ">=4,<4.10.1", 170 | "prestashop/contactform": ">1.0.1,<4.3", 171 | "prestashop/gamification": "<2.3.2", 172 | "prestashop/productcomments": ">=4,<4.2.1", 173 | "prestashop/ps_facetedsearch": "<3.4.1", 174 | "privatebin/privatebin": "<1.2.2|>=1.3,<1.3.2", 175 | "propel/propel": ">=2-alpha.1,<=2-alpha.7", 176 | "propel/propel1": ">=1,<=1.7.1", 177 | "pterodactyl/panel": "<0.7.19|>=1-rc.0,<=1-rc.6", 178 | "pusher/pusher-php-server": "<2.2.1", 179 | "rainlab/debugbar-plugin": "<3.1", 180 | "robrichards/xmlseclibs": "<3.0.4", 181 | "sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1", 182 | "sabre/dav": ">=1.6,<1.6.99|>=1.7,<1.7.11|>=1.8,<1.8.9", 183 | "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", 184 | "sensiolabs/connect": "<4.2.3", 185 | "serluck/phpwhois": "<=4.2.6", 186 | "shopware/core": "<=6.3.4", 187 | "shopware/platform": "<=6.3.5.1", 188 | "shopware/shopware": "<5.6.9", 189 | "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", 190 | "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", 191 | "silverstripe/cms": "<4.3.6|>=4.4,<4.4.4", 192 | "silverstripe/comments": ">=1.3,<1.9.99|>=2,<2.9.99|>=3,<3.1.1", 193 | "silverstripe/forum": "<=0.6.1|>=0.7,<=0.7.3", 194 | "silverstripe/framework": "<4.4.7|>=4.5,<4.5.4", 195 | "silverstripe/graphql": ">=2,<2.0.5|>=3,<3.1.2|>=3.2,<3.2.4", 196 | "silverstripe/registry": ">=2.1,<2.1.2|>=2.2,<2.2.1", 197 | "silverstripe/restfulserver": ">=1,<1.0.9|>=2,<2.0.4", 198 | "silverstripe/subsites": ">=2,<2.1.1", 199 | "silverstripe/taxonomy": ">=1.3,<1.3.1|>=2,<2.0.1", 200 | "silverstripe/userforms": "<3", 201 | "simple-updates/phpwhois": "<=1", 202 | "simplesamlphp/saml2": "<1.10.6|>=2,<2.3.8|>=3,<3.1.4", 203 | "simplesamlphp/simplesamlphp": "<1.18.6", 204 | "simplesamlphp/simplesamlphp-module-infocard": "<1.0.1", 205 | "simplito/elliptic-php": "<1.0.6", 206 | "slim/slim": "<2.6", 207 | "smarty/smarty": "<3.1.39", 208 | "socalnick/scn-social-auth": "<1.15.2", 209 | "socialiteproviders/steam": "<1.1", 210 | "spoonity/tcpdf": "<6.2.22", 211 | "squizlabs/php_codesniffer": ">=1,<2.8.1|>=3,<3.0.1", 212 | "ssddanbrown/bookstack": "<0.29.2", 213 | "stormpath/sdk": ">=0,<9.9.99", 214 | "studio-42/elfinder": "<2.1.49", 215 | "sulu/sulu": "<1.6.34|>=2,<2.0.10|>=2.1,<2.1.1", 216 | "swiftmailer/swiftmailer": ">=4,<5.4.5", 217 | "sylius/admin-bundle": ">=1,<1.0.17|>=1.1,<1.1.9|>=1.2,<1.2.2", 218 | "sylius/grid": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", 219 | "sylius/grid-bundle": ">=1,<1.1.19|>=1.2,<1.2.18|>=1.3,<1.3.13|>=1.4,<1.4.5|>=1.5,<1.5.1", 220 | "sylius/resource-bundle": "<1.3.14|>=1.4,<1.4.7|>=1.5,<1.5.2|>=1.6,<1.6.4", 221 | "sylius/sylius": "<1.6.9|>=1.7,<1.7.9|>=1.8,<1.8.3", 222 | "symbiote/silverstripe-multivaluefield": ">=3,<3.0.99", 223 | "symbiote/silverstripe-queuedjobs": ">=3,<3.0.2|>=3.1,<3.1.4|>=4,<4.0.7|>=4.1,<4.1.2|>=4.2,<4.2.4|>=4.3,<4.3.3|>=4.4,<4.4.3|>=4.5,<4.5.1|>=4.6,<4.6.4", 224 | "symbiote/silverstripe-versionedfiles": "<=2.0.3", 225 | "symfony/cache": ">=3.1,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8", 226 | "symfony/dependency-injection": ">=2,<2.0.17|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", 227 | "symfony/error-handler": ">=4.4,<4.4.4|>=5,<5.0.4", 228 | "symfony/form": ">=2.3,<2.3.35|>=2.4,<2.6.12|>=2.7,<2.7.50|>=2.8,<2.8.49|>=3,<3.4.20|>=4,<4.0.15|>=4.1,<4.1.9|>=4.2,<4.2.1", 229 | "symfony/framework-bundle": ">=2,<2.3.18|>=2.4,<2.4.8|>=2.5,<2.5.2|>=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", 230 | "symfony/http-foundation": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", 231 | "symfony/http-kernel": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.4.13|>=5,<5.1.5", 232 | "symfony/intl": ">=2.7,<2.7.38|>=2.8,<2.8.31|>=3,<3.2.14|>=3.3,<3.3.13", 233 | "symfony/mime": ">=4.3,<4.3.8", 234 | "symfony/phpunit-bridge": ">=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", 235 | "symfony/polyfill": ">=1,<1.10", 236 | "symfony/polyfill-php55": ">=1,<1.10", 237 | "symfony/proxy-manager-bridge": ">=2.7,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7", 238 | "symfony/routing": ">=2,<2.0.19", 239 | "symfony/security": ">=2,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.1.12|>=4.2,<4.2.7|>=4.4,<4.4.7|>=5,<5.0.7", 240 | "symfony/security-bundle": ">=2,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", 241 | "symfony/security-core": ">=2.4,<2.6.13|>=2.7,<2.7.9|>=2.7.30,<2.7.32|>=2.8,<2.8.37|>=3,<3.3.17|>=3.4,<3.4.7|>=4,<4.0.7", 242 | "symfony/security-csrf": ">=2.4,<2.7.48|>=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", 243 | "symfony/security-guard": ">=2.8,<2.8.41|>=3,<3.3.17|>=3.4,<3.4.11|>=4,<4.0.11", 244 | "symfony/security-http": ">=2.3,<2.3.41|>=2.4,<2.7.51|>=2.8,<2.8.50|>=3,<3.4.26|>=4,<4.2.12|>=4.3,<4.3.8|>=4.4,<4.4.7|>=5,<5.0.7", 245 | "symfony/serializer": ">=2,<2.0.11", 246 | "symfony/symfony": ">=2,<2.8.52|>=3,<3.4.35|>=4,<4.2.12|>=4.3,<4.4.13|>=5,<5.1.5", 247 | "symfony/translation": ">=2,<2.0.17", 248 | "symfony/validator": ">=2,<2.0.24|>=2.1,<2.1.12|>=2.2,<2.2.5|>=2.3,<2.3.3", 249 | "symfony/var-exporter": ">=4.2,<4.2.12|>=4.3,<4.3.8", 250 | "symfony/web-profiler-bundle": ">=2,<2.3.19|>=2.4,<2.4.9|>=2.5,<2.5.4", 251 | "symfony/yaml": ">=2,<2.0.22|>=2.1,<2.1.7", 252 | "t3g/svg-sanitizer": "<1.0.3", 253 | "tecnickcom/tcpdf": "<6.2.22", 254 | "thelia/backoffice-default-template": ">=2.1,<2.1.2", 255 | "thelia/thelia": ">=2.1-beta.1,<2.1.3", 256 | "theonedemon/phpwhois": "<=4.2.5", 257 | "titon/framework": ">=0,<9.9.99", 258 | "truckersmp/phpwhois": "<=4.3.1", 259 | "twig/twig": "<1.38|>=2,<2.7", 260 | "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1", 261 | "typo3/cms-core": ">=8,<8.7.38|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1", 262 | "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", 263 | "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", 264 | "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", 265 | "typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10", 266 | "ua-parser/uap-php": "<3.8", 267 | "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", 268 | "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", 269 | "vrana/adminer": "<4.7.9", 270 | "wallabag/tcpdf": "<6.2.22", 271 | "willdurand/js-translation-bundle": "<2.1.1", 272 | "yii2mod/yii2-cms": "<1.9.2", 273 | "yiisoft/yii": ">=1.1.14,<1.1.15", 274 | "yiisoft/yii2": "<2.0.38", 275 | "yiisoft/yii2-bootstrap": "<2.0.4", 276 | "yiisoft/yii2-dev": "<2.0.15", 277 | "yiisoft/yii2-elasticsearch": "<2.0.5", 278 | "yiisoft/yii2-gii": "<2.0.4", 279 | "yiisoft/yii2-jui": "<2.0.4", 280 | "yiisoft/yii2-redis": "<2.0.8", 281 | "yourls/yourls": "<1.7.4", 282 | "zendframework/zend-cache": ">=2.4,<2.4.8|>=2.5,<2.5.3", 283 | "zendframework/zend-captcha": ">=2,<2.4.9|>=2.5,<2.5.2", 284 | "zendframework/zend-crypt": ">=2,<2.4.9|>=2.5,<2.5.2", 285 | "zendframework/zend-db": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.10|>=2.3,<2.3.5", 286 | "zendframework/zend-developer-tools": ">=1.2.2,<1.2.3", 287 | "zendframework/zend-diactoros": ">=1,<1.8.4", 288 | "zendframework/zend-feed": ">=1,<2.10.3", 289 | "zendframework/zend-form": ">=2,<2.2.7|>=2.3,<2.3.1", 290 | "zendframework/zend-http": ">=1,<2.8.1", 291 | "zendframework/zend-json": ">=2.1,<2.1.6|>=2.2,<2.2.6", 292 | "zendframework/zend-ldap": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.8|>=2.3,<2.3.3", 293 | "zendframework/zend-mail": ">=2,<2.4.11|>=2.5,<2.7.2", 294 | "zendframework/zend-navigation": ">=2,<2.2.7|>=2.3,<2.3.1", 295 | "zendframework/zend-session": ">=2,<2.0.99|>=2.1,<2.1.99|>=2.2,<2.2.9|>=2.3,<2.3.4", 296 | "zendframework/zend-validator": ">=2.3,<2.3.6", 297 | "zendframework/zend-view": ">=2,<2.2.7|>=2.3,<2.3.1", 298 | "zendframework/zend-xmlrpc": ">=2.1,<2.1.6|>=2.2,<2.2.6", 299 | "zendframework/zendframework": "<2.5.1", 300 | "zendframework/zendframework1": "<1.12.20", 301 | "zendframework/zendopenid": ">=2,<2.0.2", 302 | "zendframework/zendxml": ">=1,<1.0.1", 303 | "zetacomponents/mail": "<1.8.2", 304 | "zf-commons/zfc-user": "<1.2.2", 305 | "zfcampus/zf-apigility-doctrine": ">=1,<1.0.3", 306 | "zfr/zfr-oauth2-server-module": "<0.1.2" 307 | }, 308 | "type": "metapackage", 309 | "notification-url": "https://packagist.org/downloads/", 310 | "license": [ 311 | "MIT" 312 | ], 313 | "authors": [ 314 | { 315 | "name": "Marco Pivetta", 316 | "email": "ocramius@gmail.com", 317 | "role": "maintainer" 318 | }, 319 | { 320 | "name": "Ilya Tribusean", 321 | "email": "slash3b@gmail.com", 322 | "role": "maintainer" 323 | } 324 | ], 325 | "description": "Prevents installation of composer packages with known security vulnerabilities: no API, simply require it", 326 | "support": { 327 | "issues": "https://github.com/Roave/SecurityAdvisories/issues", 328 | "source": "https://github.com/Roave/SecurityAdvisories/tree/latest" 329 | }, 330 | "funding": [ 331 | { 332 | "url": "https://github.com/Ocramius", 333 | "type": "github" 334 | }, 335 | { 336 | "url": "https://tidelift.com/funding/github/packagist/roave/security-advisories", 337 | "type": "tidelift" 338 | } 339 | ], 340 | "time": "2021-03-16T14:08:12+00:00" 341 | }, 342 | { 343 | "name": "swoole/ide-helper", 344 | "version": "4.6.4", 345 | "source": { 346 | "type": "git", 347 | "url": "https://github.com/swoole/ide-helper.git", 348 | "reference": "7e5c51ce7cc8c03ffb836aad31f3f27cd871aa96" 349 | }, 350 | "dist": { 351 | "type": "zip", 352 | "url": "https://api.github.com/repos/swoole/ide-helper/zipball/7e5c51ce7cc8c03ffb836aad31f3f27cd871aa96", 353 | "reference": "7e5c51ce7cc8c03ffb836aad31f3f27cd871aa96", 354 | "shasum": "" 355 | }, 356 | "require-dev": { 357 | "guzzlehttp/guzzle": "~6.5.0", 358 | "laminas/laminas-code": "~3.4.0", 359 | "squizlabs/php_codesniffer": "~3.5.0", 360 | "symfony/filesystem": "~4.0" 361 | }, 362 | "type": "library", 363 | "notification-url": "https://packagist.org/downloads/", 364 | "license": [ 365 | "Apache-2.0" 366 | ], 367 | "authors": [ 368 | { 369 | "name": "Team Swoole", 370 | "email": "team@swoole.com" 371 | } 372 | ], 373 | "description": "IDE help files for Swoole.", 374 | "support": { 375 | "issues": "https://github.com/swoole/ide-helper/issues", 376 | "source": "https://github.com/swoole/ide-helper/tree/4.6.4" 377 | }, 378 | "time": "2021-03-11T19:44:34+00:00" 379 | } 380 | ], 381 | "aliases": [], 382 | "minimum-stability": "stable", 383 | "stability-flags": { 384 | "roave/security-advisories": 20 385 | }, 386 | "prefer-stable": false, 387 | "prefer-lowest": false, 388 | "platform": [], 389 | "platform-dev": [], 390 | "plugin-api-version": "2.0.0" 391 | } 392 | -------------------------------------------------------------------------------- /var/runtime/lib/API.php: -------------------------------------------------------------------------------- 1 | client = new Client($host, $port); 22 | $this->client->setHeaders(['Content-type' => 'application/json']); 23 | } 24 | 25 | public function next(): array 26 | { 27 | $this->client->get('/2018-06-01/runtime/invocation/next'); 28 | $this->requestId = $this->client->headers[self::REQUEST_ID_HEADER]; 29 | 30 | $context = json_decode($this->client->body, true, 512, JSON_THROW_ON_ERROR); 31 | 32 | if (!is_array($context)) { 33 | $context = ['payload' => $context]; 34 | } 35 | 36 | $context['request_id'] = $this->requestId; 37 | return $context; 38 | } 39 | 40 | public function response(JsonSerializable|string|array|int|float $data): void 41 | { 42 | $this->client->post("/2018-06-01/runtime/invocation/{$this->requestId}/response", json_encode($data, JSON_THROW_ON_ERROR)); 43 | } 44 | 45 | public function error(Throwable $err): void 46 | { 47 | $this->client->post("/2018-06-01/runtime/invocation/{$this->requestId}/error", json_encode([ 48 | 'errorMessage' => $err->getMessage(), 49 | 'errorType' => $err::class, 50 | ], JSON_THROW_ON_ERROR)); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /var/task/index.php: -------------------------------------------------------------------------------- 1 |