From 2272461590cbe1cc477e8eec79623dfb8adf4541 Mon Sep 17 00:00:00 2001 From: Luis Pabon Date: Fri, 24 Nov 2023 12:06:57 +0000 Subject: [PATCH 1/2] PHP 8.3 support Changes: * Remove php 8.0 (eol) * Add php 8.3 * Make it the default --- public/js/main-form.js | 10 +- src/Controller/GeneratorController.php | 2 +- src/Form/Generator/PhpType.php | 16 +- .../AvailableExtensionsFactory.php | 4 +- ...sions.php => Php83AvailableExtensions.php} | 143 +++++++++--------- src/PHPDocker/Project/ServiceOptions/Php.php | 5 +- templates/generator.html.twig | 4 +- 7 files changed, 91 insertions(+), 93 deletions(-) rename src/PHPDocker/PhpExtension/{Php80AvailableExtensions.php => Php83AvailableExtensions.php} (77%) diff --git a/public/js/main-form.js b/public/js/main-form.js index f785a268..9f4326ed 100644 --- a/public/js/main-form.js +++ b/public/js/main-form.js @@ -102,15 +102,15 @@ function doMainFormMagic () { phpVersionSelector.on('change', function () { extensionMultiSelects.parents('.form-group').hide() - let chosenVersion = '82' + let chosenVersion = '83' switch ($(this).val()) { - case '8.0': - chosenVersion = '80' - break - case '8.1': chosenVersion = '81' break + + case '8.2': + chosenVersion = '82' + break } extensionMultiSelects.filter('[id$=' + chosenVersion + ']').parents('.form-group').show() diff --git a/src/Controller/GeneratorController.php b/src/Controller/GeneratorController.php index 06866c4f..c125206a 100644 --- a/src/Controller/GeneratorController.php +++ b/src/Controller/GeneratorController.php @@ -75,9 +75,9 @@ private function hydrateProject(array $formData): Project $phpData = $formData['phpOptions']; $extensions = match ($phpData['version']) { - PhpOptions::PHP_VERSION_80 => $phpData['phpExtensions80'], PhpOptions::PHP_VERSION_81 => $phpData['phpExtensions81'], PhpOptions::PHP_VERSION_82 => $phpData['phpExtensions82'], + PhpOptions::PHP_VERSION_83 => $phpData['phpExtensions83'], default => throw new InvalidArgumentException(sprintf('Unsupported php version %s', $phpData['version'])), }; diff --git a/src/Form/Generator/PhpType.php b/src/Form/Generator/PhpType.php index 9cd5641e..79f6268c 100644 --- a/src/Form/Generator/PhpType.php +++ b/src/Form/Generator/PhpType.php @@ -19,9 +19,9 @@ namespace App\Form\Generator; -use App\PHPDocker\PhpExtension\Php80AvailableExtensions; use App\PHPDocker\PhpExtension\Php81AvailableExtensions; use App\PHPDocker\PhpExtension\Php82AvailableExtensions; +use App\PHPDocker\PhpExtension\Php83AvailableExtensions; use App\PHPDocker\PhpExtension\PhpExtension; use App\PHPDocker\Project\ServiceOptions\Php; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; @@ -76,13 +76,6 @@ public function buildForm(FormBuilderInterface $builder, array $options): void new Choice(choices: Php::getSupportedVersions()), ], ]) - ->add('phpExtensions80', ChoiceType::class, [ - 'choices' => $this->getExtensionChoices((new Php80AvailableExtensions())->getOptional()), - 'multiple' => true, - 'label' => 'Extensions (PHP 8.0)', - 'required' => false, - 'constraints' => $phpOptionsConstraints, - ]) ->add('phpExtensions81', ChoiceType::class, [ 'choices' => $this->getExtensionChoices((new Php81AvailableExtensions())->getOptional()), 'multiple' => true, @@ -96,6 +89,13 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'label' => 'Extensions (PHP 8.2)', 'required' => false, 'constraints' => $phpOptionsConstraints, + ]) + ->add('phpExtensions83', ChoiceType::class, [ + 'choices' => $this->getExtensionChoices((new Php83AvailableExtensions())->getOptional()), + 'multiple' => true, + 'label' => 'Extensions (PHP 8.3)', + 'required' => false, + 'constraints' => $phpOptionsConstraints, ]); } diff --git a/src/PHPDocker/PhpExtension/AvailableExtensionsFactory.php b/src/PHPDocker/PhpExtension/AvailableExtensionsFactory.php index 43bbdd77..2954de7f 100644 --- a/src/PHPDocker/PhpExtension/AvailableExtensionsFactory.php +++ b/src/PHPDocker/PhpExtension/AvailableExtensionsFactory.php @@ -26,17 +26,17 @@ */ class AvailableExtensionsFactory { - private const PHP_VERSION_80 = '8.0'; private const PHP_VERSION_81 = '8.1'; private const PHP_VERSION_82 = '8.2'; + private const PHP_VERSION_83 = '8.3'; /** * Supported PHP versions */ private const SUPPORTED_VERSIONS = [ - self::PHP_VERSION_80 => Php80AvailableExtensions::class, self::PHP_VERSION_81 => Php81AvailableExtensions::class, self::PHP_VERSION_82 => Php82AvailableExtensions::class, + self::PHP_VERSION_83 => Php83AvailableExtensions::class, ]; /** diff --git a/src/PHPDocker/PhpExtension/Php80AvailableExtensions.php b/src/PHPDocker/PhpExtension/Php83AvailableExtensions.php similarity index 77% rename from src/PHPDocker/PhpExtension/Php80AvailableExtensions.php rename to src/PHPDocker/PhpExtension/Php83AvailableExtensions.php index 9011de44..fd9801c0 100644 --- a/src/PHPDocker/PhpExtension/Php80AvailableExtensions.php +++ b/src/PHPDocker/PhpExtension/Php83AvailableExtensions.php @@ -1,8 +1,7 @@ ['packages' => ['php8.0-curl']], - 'MBSTRING' => ['packages' => ['php8.0-mbstring']], - 'OPCache' => ['packages' => ['php8.0-opcache']], - 'Readline' => ['packages' => ['php8.0-readline']], - 'XML' => ['packages' => ['php8.0-xml']], - 'Zip' => ['packages' => ['php8.0-zip']], + 'cURL' => ['packages' => ['php8.3-curl']], + 'MBSTRING' => ['packages' => ['php8.3-mbstring']], + 'OPCache' => ['packages' => ['php8.3-opcache']], + 'Readline' => ['packages' => ['php8.3-readline']], + 'XML' => ['packages' => ['php8.3-xml']], + 'Zip' => ['packages' => ['php8.3-zip']], ]; } @@ -45,68 +44,68 @@ protected function getMandatoryExtensionsMap(): array protected function getOptionalExtensionsMap(): array { return [ - 'AMQP' => ['packages' => ['php8.0-amqp']], - 'AST' => ['packages' => ['php8.0-ast']], - 'Bcmath' => ['packages' => ['php8.0-bcmath']], - 'bzip2' => ['packages' => ['php8.0-bz2']], - 'CGI' => ['packages' => ['php8.0-cgi']], - 'DBA' => ['packages' => ['php8.0-dba']], - 'Decimal' => ['packages' => ['php8.0-decimal']], - 'DS (Data Structures)' => ['packages' => ['php8.0-ds']], - 'Enchant' => ['packages' => ['php8.0-enchant']], - 'GD' => ['packages' => ['php8.0-gd']], - 'Gearman' => ['packages' => ['php8.0-gearman']], - 'Gmagick (GraphicsMagick)' => ['packages' => ['php8.0-gmagick']], - 'GMP' => ['packages' => ['php8.0-gmp']], - 'GNUPG' => ['packages' => ['php8.0-gnupg']], - 'GRPC' => ['packages' => ['php8.0-grpc']], - 'HTTP' => ['packages' => ['php8.0-http']], - 'igbinary' => ['packages' => ['php8.0-igbinary']], - 'ImageMagick' => ['packages' => ['php8.0-imagick']], - 'IMAP' => ['packages' => ['php8.0-imap']], - 'Inotify' => ['packages' => ['php8.0-inotify']], - 'Interbase' => ['packages' => ['php8.0-interbase']], - 'Intl (Internationalisation)' => ['packages' => ['php8.0-intl']], - 'LDAP' => ['packages' => ['php8.0-ldap']], - 'LZ4' => ['packages' => ['php8.0-lz4']], - 'Mailparse' => ['packages' => ['php8.0-mailparse']], - 'MaxMind DB' => ['packages' => ['php8.0-maxminddb']], - 'mcrypt' => ['packages' => ['php8.0-mcrypt']], - 'Memcache' => ['packages' => ['php8.0-memcache']], - 'Memcached' => ['packages' => ['php8.0-memcached']], - 'MongoDB' => ['packages' => ['php8.0-mongodb']], - 'MessagePack' => ['packages' => ['php8.0-msgpack']], - 'MySQL' => ['packages' => ['php8.0-mysql']], - 'OAuth' => ['packages' => ['php8.0-oauth']], - 'ODBC' => ['packages' => ['php8.0-odbc']], - 'Pcov' => ['packages' => ['php8.0-pcov']], - 'PostgreSQL' => ['packages' => ['php8.0-pgsql']], - 'PHPDBG' => ['packages' => ['php8.0-phpdbg']], - 'Protobuf' => ['packages' => ['php8.0-protobuf']], - 'pspell' => ['packages' => ['php8.0-pspell']], - 'PSR' => ['packages' => ['php8.0-psr']], - 'raphf' => ['packages' => ['php8.0-raphf']], - 'Redis' => ['packages' => ['php8.0-redis']], - 'rrd' => ['packages' => ['php8.0-rrd']], - 'Samba Client' => ['packages' => ['php8.0-smbclient']], - 'SNMP' => ['packages' => ['php8.0-snmp']], - 'SOAP' => ['packages' => ['php8.0-soap']], - 'Solr' => ['packages' => ['php8.0-solr']], - 'SQLite3' => ['packages' => ['php8.0-sqlite3']], - 'ssh2' => ['packages' => ['php8.0-ssh2']], - 'Swoole' => ['packages' => ['php8.0-swoole']], - 'Sybase' => ['packages' => ['php8.0-sybase']], - 'Tidy' => ['packages' => ['php8.0-tidy']], - 'UUID' => ['packages' => ['php8.0-uuid']], - 'vips' => ['packages' => ['php8.0-vips']], - 'Xdebug' => ['packages' => ['php8.0-xdebug']], - 'Xhprof' => ['packages' => ['php8.0-xhprof']], - 'XMLRPC' => ['packages' => ['php8.0-xmlrpc']], - 'XSL' => ['packages' => ['php8.0-xsl']], - 'Yac' => ['packages' => ['php8.0-yac']], - 'YAML' => ['packages' => ['php8.0-yaml']], - 'ZMQ (ZeroMQ)' => ['packages' => ['php8.0-zmq']], - 'zstd (Zstandard)' => ['packages' => ['php8.0-zstd']], + 'AMQP' => ['packages' => ['php8.3-amqp']], + 'AST' => ['packages' => ['php8.3-ast']], + 'Bcmath' => ['packages' => ['php8.3-bcmath']], + 'bzip2' => ['packages' => ['php8.3-bz2']], + 'CGI' => ['packages' => ['php8.3-cgi']], + 'DBA' => ['packages' => ['php8.3-dba']], + 'Decimal' => ['packages' => ['php8.3-decimal']], + 'DS (Data Structures)' => ['packages' => ['php8.3-ds']], + 'Enchant' => ['packages' => ['php8.3-enchant']], + 'GD' => ['packages' => ['php8.3-gd']], + 'Gearman' => ['packages' => ['php8.3-gearman']], + 'Gmagick (GraphicsMagick)' => ['packages' => ['php8.3-gmagick']], + 'GMP' => ['packages' => ['php8.3-gmp']], + 'GNUPG' => ['packages' => ['php8.3-gnupg']], + 'GRPC' => ['packages' => ['php8.3-grpc']], + 'HTTP' => ['packages' => ['php8.3-http']], + 'igbinary' => ['packages' => ['php8.3-igbinary']], + 'ImageMagick' => ['packages' => ['php8.3-imagick']], + 'IMAP' => ['packages' => ['php8.3-imap']], + 'Inotify' => ['packages' => ['php8.3-inotify']], + 'Interbase' => ['packages' => ['php8.3-interbase']], + 'Intl (Internationalisation)' => ['packages' => ['php8.3-intl']], + 'LDAP' => ['packages' => ['php8.3-ldap']], + 'LZ4' => ['packages' => ['php8.3-lz4']], + 'Mailparse' => ['packages' => ['php8.3-mailparse']], + 'MaxMind DB' => ['packages' => ['php8.3-maxminddb']], + 'mcrypt' => ['packages' => ['php8.3-mcrypt']], + 'Memcache' => ['packages' => ['php8.3-memcache']], + 'Memcached' => ['packages' => ['php8.3-memcached']], + 'MongoDB' => ['packages' => ['php8.3-mongodb']], + 'MessagePack' => ['packages' => ['php8.3-msgpack']], + 'MySQL' => ['packages' => ['php8.3-mysql']], + 'OAuth' => ['packages' => ['php8.3-oauth']], + 'ODBC' => ['packages' => ['php8.3-odbc']], + 'Pcov' => ['packages' => ['php8.3-pcov']], + 'PostgreSQL' => ['packages' => ['php8.3-pgsql']], + 'PHPDBG' => ['packages' => ['php8.3-phpdbg']], + 'Protobuf' => ['packages' => ['php8.3-protobuf']], + 'pspell' => ['packages' => ['php8.3-pspell']], + 'PSR' => ['packages' => ['php8.3-psr']], + 'raphf' => ['packages' => ['php8.3-raphf']], + 'Redis' => ['packages' => ['php8.3-redis']], + 'rrd' => ['packages' => ['php8.3-rrd']], + 'Samba Client' => ['packages' => ['php8.3-smbclient']], + 'SNMP' => ['packages' => ['php8.3-snmp']], + 'SOAP' => ['packages' => ['php8.3-soap']], + 'Solr' => ['packages' => ['php8.3-solr']], + 'SQLite3' => ['packages' => ['php8.3-sqlite3']], + 'ssh2' => ['packages' => ['php8.3-ssh2']], + 'Swoole' => ['packages' => ['php8.3-swoole']], + 'Sybase' => ['packages' => ['php8.3-sybase']], + 'Tidy' => ['packages' => ['php8.3-tidy']], + 'UUID' => ['packages' => ['php8.3-uuid']], + 'vips' => ['packages' => ['php8.3-vips']], + 'Xdebug' => ['packages' => ['php8.3-xdebug']], + 'Xhprof' => ['packages' => ['php8.3-xhprof']], + 'XMLRPC' => ['packages' => ['php8.3-xmlrpc']], + 'XSL' => ['packages' => ['php8.3-xsl']], + 'Yac' => ['packages' => ['php8.3-yac']], + 'YAML' => ['packages' => ['php8.3-yaml']], + 'ZMQ (ZeroMQ)' => ['packages' => ['php8.3-zmq']], + 'zstd (Zstandard)' => ['packages' => ['php8.3-zstd']], ]; } } diff --git a/src/PHPDocker/Project/ServiceOptions/Php.php b/src/PHPDocker/Project/ServiceOptions/Php.php index 90ec5fa7..c0315e98 100644 --- a/src/PHPDocker/Project/ServiceOptions/Php.php +++ b/src/PHPDocker/Project/ServiceOptions/Php.php @@ -28,10 +28,9 @@ */ class Php extends Base { - public const PHP_VERSION_74 = '7.4'; - public const PHP_VERSION_80 = '8.0'; public const PHP_VERSION_81 = '8.1'; public const PHP_VERSION_82 = '8.2'; + public const PHP_VERSION_83 = '8.3'; private string $version; @@ -42,9 +41,9 @@ class Php extends Base * Supported PHP versions */ private const SUPPORTED_VERSIONS = [ + self::PHP_VERSION_83, self::PHP_VERSION_82, self::PHP_VERSION_81, - self::PHP_VERSION_80, ]; /** diff --git a/templates/generator.html.twig b/templates/generator.html.twig index 087b695d..0906576e 100644 --- a/templates/generator.html.twig +++ b/templates/generator.html.twig @@ -58,11 +58,11 @@
+ {{ form_row(attribute(form.phpOptions, 'phpExtensions83')) }} + {{ form_row(attribute(form.phpOptions, 'phpExtensions82')) }} {{ form_row(attribute(form.phpOptions, 'phpExtensions81')) }} - - {{ form_row(attribute(form.phpOptions, 'phpExtensions80')) }}
From e323dce84bae9cb7517df140cb238c811c0ebfc3 Mon Sep 17 00:00:00 2001 From: Luis Pabon Date: Fri, 24 Nov 2023 12:10:54 +0000 Subject: [PATCH 2/2] Docs --- src/PHPDocker/PhpExtension/Php83AvailableExtensions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PHPDocker/PhpExtension/Php83AvailableExtensions.php b/src/PHPDocker/PhpExtension/Php83AvailableExtensions.php index fd9801c0..1b52d2c9 100644 --- a/src/PHPDocker/PhpExtension/Php83AvailableExtensions.php +++ b/src/PHPDocker/PhpExtension/Php83AvailableExtensions.php @@ -1,7 +1,7 @@