Browse Source

[php] Add Laravel Octane with Frankenphp (#8944)

* [php] Add Laravel Octnae with Frankenphp

* Disable php extensions build output

* Disable X-powered-by header
and use optimized php.ini
Joan Miquel 1 year ago
parent
commit
a565bcb2c2

+ 23 - 0
frameworks/PHP/laravel/benchmark_config.json

@@ -115,6 +115,29 @@
 			"display_name": "laravel-workerman",
 			"notes": "",
 			"versus": "php"
+		},
+		"octane-frankenphp": {
+			"json_url": "/json",
+			"db_url": "/db",
+			"query_url": "/queries/",
+			"fortune_url": "/fortunes",
+			"update_url": "/updates/",
+			"plaintext_url": "/plaintext",
+			"port": 8080,
+			"approach": "Realistic",
+			"classification": "Fullstack",
+			"database": "MySQL",
+			"framework": "laravel",
+			"language": "PHP",
+			"flavor": "None",
+			"orm": "Full",
+			"platform": "Frankenphp",
+			"webserver": "caddy",
+			"os": "Linux",
+			"database_os": "Linux",
+			"display_name": "laravel-octane [frankenphp]",
+			"notes": "",
+			"versus": "php"
 		}
 	}]
 }

+ 1 - 1
frameworks/PHP/laravel/config/app.php

@@ -142,7 +142,7 @@ return [
 		// Illuminate\Redis\RedisServiceProvider::class,
 		// Illuminate\Auth\Passwords\PasswordResetServiceProvider::class,
 		// Illuminate\Session\SessionServiceProvider::class,
-		// Illuminate\Translation\TranslationServiceProvider::class,
+		Illuminate\Translation\TranslationServiceProvider::class,
 		// Illuminate\Validation\ValidationServiceProvider::class,
 		Illuminate\View\ViewServiceProvider::class,
 

+ 29 - 0
frameworks/PHP/laravel/laravel-octane-frankenphp.dockerfile

@@ -0,0 +1,29 @@
+FROM dunglas/frankenphp
+ 
+RUN install-php-extensions \
+    pcntl \
+    pdo_mysql \
+	intl \
+	zip \
+	opcache > /dev/null
+ 
+COPY . /app
+
+COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer
+
+RUN mkdir -p /app/bootstrap/cache /app/storage/logs /app/storage/framework/sessions /app/storage/framework/views /app/storage/framework/cache
+RUN chmod -R 777 /app
+
+COPY deploy/conf/php.ini  /usr/local/etc/php
+
+RUN composer require laravel/octane guzzlehttp/guzzle
+
+RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet
+
+RUN php artisan optimize
+
+RUN frankenphp -v
+
+EXPOSE 8080
+
+ENTRYPOINT ["php", "artisan", "octane:frankenphp", "--port=8080"]