Skip to content

Commit

Permalink
Merge pull request #364 from phpdocker-io/php83
Browse files Browse the repository at this point in the history
PHP 8.3 support
  • Loading branch information
luispabon authored Dec 27, 2023
2 parents b718cff + e323dce commit 9fe0744
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 92 deletions.
10 changes: 5 additions & 5 deletions public/js/main-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/GeneratorController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'])),
};

Expand Down
16 changes: 8 additions & 8 deletions src/Form/Generator/PhpType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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,
]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/PHPDocker/PhpExtension/AvailableExtensionsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
declare(strict_types=1);

/**
* Copyright 2019 Luis Alberto Pabón Flores
* Copyright 2023 Luis Alberto Pabón Flores
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -20,7 +19,7 @@

namespace App\PHPDocker\PhpExtension;

class Php80AvailableExtensions extends BaseAvailableExtensions
class Php83AvailableExtensions extends BaseAvailableExtensions
{
/**
* @inheritDoc
Expand All @@ -29,12 +28,12 @@ class Php80AvailableExtensions extends BaseAvailableExtensions
protected function getMandatoryExtensionsMap(): array
{
return [
'cURL' => ['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']],
];
}

Expand All @@ -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']],
];
}
}
5 changes: 2 additions & 3 deletions src/PHPDocker/Project/ServiceOptions/Php.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
];

/**
Expand Down
4 changes: 2 additions & 2 deletions templates/generator.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@
</div>

<div class="col col-lg-6 col-md-6">
{{ form_row(attribute(form.phpOptions, 'phpExtensions83')) }}

{{ form_row(attribute(form.phpOptions, 'phpExtensions82')) }}

{{ form_row(attribute(form.phpOptions, 'phpExtensions81')) }}

{{ form_row(attribute(form.phpOptions, 'phpExtensions80')) }}
</div>
</div>
</div>
Expand Down

0 comments on commit 9fe0744

Please sign in to comment.