* [php] Lumen update to v9 & adapterman * Update composer * Update swoole to php 8..1 * Update to php 8.1 * Add adapterman * Update dockerfiles * Update laravel-s to lumen v9
@@ -69,6 +69,29 @@
"display_name": "lumen-laravel-s",
"notes": "",
"versus": "swoole"
+ },
+ "workerman": {
+ "json_url": "/json",
+ "db_url": "/db",
+ "query_url": "/queries/",
+ "fortune_url": "/fortunes",
+ "update_url": "/updates/",
+ "plaintext_url": "/plaintext",
+ "port": 8080,
+ "approach": "Realistic",
+ "classification": "Micro",
+ "database": "MySQL",
+ "framework": "lumen",
+ "language": "PHP",
+ "flavor": "PHP8",
+ "orm": "Full",
+ "platform": "workerman",
+ "webserver": "none",
+ "os": "Linux",
+ "database_os": "Linux",
+ "display_name": "lumen-workerman",
+ "notes": "",
+ "versus": "workerman"
}
}]
@@ -5,24 +5,13 @@
"license": "MIT",
"type": "project",
"require": {
- "laravel/lumen-framework": "^8.2"
- },
- "require-dev": {
- "fzaninotto/faker": "^1.9.1",
- "mockery/mockery": "^1.3.1",
- "phpunit/phpunit": "^9.3"
+ "laravel/lumen-framework": "^9"
},
"autoload": {
"psr-4": {
"App\\": "app/"
- "autoload-dev": {
- "classmap": [
- "tests/",
- "database/"
- ]
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
@@ -0,0 +1,16 @@
+#zend_extension=opcache.so
+opcache.enable=1
+opcache.enable_cli=1
+opcache.validate_timestamps=0
+opcache.save_comments=0
+opcache.enable_file_override=1
+opcache.huge_code_pages=1
+
+mysqlnd.collect_statistics = Off
+memory_limit = 512M
+opcache.jit_buffer_size = 128M
+opcache.jit = tracing
+disable_functions=header,header_remove,http_response_code,setcookie,session_create_id,session_id,session_name,session_save_path,session_status,session_start,session_write_close,session_regenerate_id,set_time_limit
@@ -5,7 +5,7 @@
- "laravel/lumen-framework": "^8.2",
+ "laravel/lumen-framework": "^9",
"hhxsv5/laravel-s": "~3.7.0"
"require-dev": {
@@ -5,26 +5,14 @@
- "php": "^7.3",
- "laravel/lumen-framework": "^8.1",
- "swooletw/laravel-swoole": "^v2.6"
+ "swooletw/laravel-swoole": "^v2.12"
@@ -1,4 +1,4 @@
-FROM php:8.0-cli
+FROM php:8.1-cli
RUN pecl install swoole > /dev/null && \
docker-php-ext-enable swoole
-FROM php:7.4
@@ -0,0 +1,33 @@
+FROM ubuntu:22.04
+ARG DEBIAN_FRONTEND=noninteractive
+RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
+RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \
+ apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null
+RUN apt-get install -yqq nginx git unzip \
+ php8.1-cli php8.1-mysql php8.1-mbstring php8.1-xml php8.1-dev > /dev/null
+COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
+RUN apt-get install -y php-pear php8.1-dev libevent-dev > /dev/null
+RUN pecl install event-3.0.8 > /dev/null && echo "extension=event.so" > /etc/php/8.1/cli/conf.d/event.ini
+ADD ./ /lumen
+WORKDIR /lumen
+RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
+RUN composer require joanhey/adapterman --quiet
+RUN mkdir -p /lumen/storage
+RUN mkdir -p /lumen/storage/framework/sessions
+RUN mkdir -p /lumen/storage/framework/views
+RUN mkdir -p /lumen/storage/framework/cache
+RUN chmod -R 777 /lumen
+EXPOSE 8080
+CMD php -c deploy/conf/cli-php.ini \
+ server-man.php start
@@ -1,13 +1,13 @@
-FROM ubuntu:20.04
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update -yqq && apt-get install -yqq software-properties-common > /dev/null
-RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php
-RUN apt-get update -yqq > /dev/null && \
- apt-get install -yqq nginx git unzip \
- php8.1-cli php8.1-fpm php8.1-mysql > /dev/null
-RUN apt-get install -yqq php8.1-mbstring php8.1-xml php8.1-dev > /dev/null
+ php8.1-cli php8.1-fpm php8.1-mysql php8.1-mbstring php8.1-xml php8.1-dev > /dev/null
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
@@ -0,0 +1,45 @@
+<?php
+require_once __DIR__ . '/vendor/autoload.php';
+use Adapterman\Adapterman;
+use Workerman\Worker;
+use Workerman\Lib\Timer;
+Adapterman::init();
+$http_worker = new Worker('http://0.0.0.0:8080');
+$http_worker->count = (int) shell_exec('nproc') * 4;
+$http_worker->name = 'AdapterMan-Laravel';
+$http_worker->onWorkerStart = function () {
+ HeaderDate::init();
+ //init();
+ require __DIR__.'/start.php';
+};
+$http_worker->onMessage = static function ($connection, $request) {
+ $connection->send(run());
+Worker::runAll();
+class HeaderDate
+{
+ const NAME = 'Date: ';
+ /**
+ * Date header
+ *
+ * @var string
+ */
+ public static $date;
+ public static function init(): void
+ {
+ self::$date = self::NAME . gmdate('D, d M Y H:i:s').' GMT';
+ Timer::add(1, static function() {
+ });
+ }
+}
@@ -0,0 +1,39 @@
+/*
+|--------------------------------------------------------------------------
+| Create The Application
+|
+| First we need to get an application instance. This creates an instance
+| of the application / container and bootstraps the application so it
+| is ready to receive HTTP / Console requests from the environment.
+*/
+global $app;
+$app = require __DIR__.'/bootstrap/app.php';
+| Run The Application
+| Once we have the application, we can handle the incoming request
+| through the kernel, and send the associated response back to
+| the client's browser allowing them to enjoy the creative
+| and wonderful application we have prepared for them.
+function run()
+ global $app;
+ ob_start();
+ $app->run();
+ header(HeaderDate::$date); // To pass the bench, nginx auto add it
+ return ob_get_clean();