Record Class PhpRuntimeConfig
java.lang.Object
java.lang.Record
com.cloudforge.core.interfaces.PhpRuntimeConfig
- Record Components:
version- PHP version (e.g., "8.2", "8.1")extensions- List of required PHP extensionsphpIni- Custom php.ini settingsfpmConfig- PHP-FPM pool configurationopcacheConfig- OPcache settingsmemoryLimit- PHP memory_limit in MBmaxExecutionTime- max_execution_time in secondsuploadMaxFilesize- upload_max_filesize in MBpostMaxSize- post_max_size in MB
public record PhpRuntimeConfig(String version, List<String> extensions, Map<String,String> phpIni, Map<String,String> fpmConfig, Map<String,String> opcacheConfig, int memoryLimit, int maxExecutionTime, int uploadMaxFilesize, int postMaxSize)
extends Record
PHP runtime configuration for CMS deployments.
This record encapsulates all PHP-related configuration including:
- PHP version and extensions
- PHP-FPM pool settings
- OPcache configuration
- Memory and execution limits
- Upload size limits
Usage Example:
PhpRuntimeConfig config = PhpRuntimeConfig.defaults()
.withVersion("8.2")
.withMemoryLimit(512)
.withExtensions(List.of("mysqli", "gd", "redis"));
- Since:
- 3.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionExtensions for caching backends.Common PHP extensions required by most CMS platforms.Extensions for e-commerce platforms (encryption, math).Extensions for image processing (beyond basic GD). -
Constructor Summary
ConstructorsConstructorDescriptionPhpRuntimeConfig(String version, List<String> extensions, Map<String, String> phpIni, Map<String, String> fpmConfig, Map<String, String> opcacheConfig, int memoryLimit, int maxExecutionTime, int uploadMaxFilesize, int postMaxSize) Creates an instance of aPhpRuntimeConfigrecord class. -
Method Summary
Modifier and TypeMethodDescriptionstatic PhpRuntimeConfigdefaults()Creates a default PHP runtime configuration suitable for most CMS platforms.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theextensionsrecord component.static PhpRuntimeConfigCreates a configuration for Drupal.static PhpRuntimeConfigCreates a configuration optimized for WooCommerce/e-commerce.static PhpRuntimeConfigCreates a configuration optimized for Magento 2.static PhpRuntimeConfigCreates a configuration for social networking platforms (Dolphin/UNA, HumHub).static PhpRuntimeConfigCreates a configuration optimized for WordPress.Returns the value of thefpmConfigrecord component.Generates PHP-FPM pool configuration content.Generates php.ini content from configuration.Returns the base Docker image for this PHP version.Returns the PHP-FPM pool name.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxExecutionTimerecord component.intReturns the value of thememoryLimitrecord component.Returns the value of theopcacheConfigrecord component.phpIni()Returns the value of thephpInirecord component.intReturns the value of thepostMaxSizerecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of theuploadMaxFilesizerecord component.version()Returns the value of theversionrecord component.withAdditionalExtensions(List<String> additionalExtensions) Returns a new config with additional extensions added.withExtensions(List<String> extensions) Returns a new config with the specified extensions.withFpmConfig(Map<String, String> fpmConfig) Returns a new config with the specified PHP-FPM settings.withMaxExecutionTime(int maxExecutionTime) Returns a new config with the specified max execution time.withMemoryLimit(int memoryLimit) Returns a new config with the specified memory limit.withOpcacheConfig(Map<String, String> opcacheConfig) Returns a new config with the specified OPcache settings.withPhpIni(Map<String, String> phpIni) Returns a new config with the specified php.ini settings.withPostMaxSize(int postMaxSize) Returns a new config with the specified post max size.withUploadMaxFilesize(int uploadMaxFilesize) Returns a new config with the specified upload max filesize.withVersion(String version) Returns a new config with the specified PHP version.
-
Field Details
-
COMMON_EXTENSIONS
-
IMAGE_EXTENSIONS
-
CACHE_EXTENSIONS
-
ECOMMERCE_EXTENSIONS
-
-
Constructor Details
-
PhpRuntimeConfig
public PhpRuntimeConfig(String version, List<String> extensions, Map<String, String> phpIni, Map<String, String> fpmConfig, Map<String, String> opcacheConfig, int memoryLimit, int maxExecutionTime, int uploadMaxFilesize, int postMaxSize) Creates an instance of aPhpRuntimeConfigrecord class.- Parameters:
version- the value for theversionrecord componentextensions- the value for theextensionsrecord componentphpIni- the value for thephpInirecord componentfpmConfig- the value for thefpmConfigrecord componentopcacheConfig- the value for theopcacheConfigrecord componentmemoryLimit- the value for thememoryLimitrecord componentmaxExecutionTime- the value for themaxExecutionTimerecord componentuploadMaxFilesize- the value for theuploadMaxFilesizerecord componentpostMaxSize- the value for thepostMaxSizerecord component
-
-
Method Details
-
defaults
Creates a default PHP runtime configuration suitable for most CMS platforms.Default values:
- PHP 8.2
- Common extensions + redis
- 256MB memory limit
- 300 second max execution time
- 64MB upload limit
- Returns:
- default PhpRuntimeConfig
-
forWordPress
Creates a configuration optimized for WordPress.- Returns:
- WordPress-optimized PhpRuntimeConfig
-
forEcommerce
Creates a configuration optimized for WooCommerce/e-commerce.- Returns:
- E-commerce optimized PhpRuntimeConfig
-
forMagento
Creates a configuration optimized for Magento 2.- Returns:
- Magento-optimized PhpRuntimeConfig
-
forDrupal
Creates a configuration for Drupal.- Returns:
- Drupal-optimized PhpRuntimeConfig
-
forSocial
Creates a configuration for social networking platforms (Dolphin/UNA, HumHub).- Returns:
- Social platform optimized PhpRuntimeConfig
-
withVersion
Returns a new config with the specified PHP version.- Parameters:
version- PHP version (e.g., "8.2", "8.1")- Returns:
- new PhpRuntimeConfig with updated version
-
withExtensions
Returns a new config with the specified extensions.- Parameters:
extensions- list of PHP extension names- Returns:
- new PhpRuntimeConfig with updated extensions
-
withAdditionalExtensions
Returns a new config with additional extensions added.- Parameters:
additionalExtensions- extensions to add- Returns:
- new PhpRuntimeConfig with extensions added
-
withPhpIni
Returns a new config with the specified php.ini settings.- Parameters:
phpIni- map of php.ini key-value pairs- Returns:
- new PhpRuntimeConfig with updated php.ini
-
withFpmConfig
Returns a new config with the specified PHP-FPM settings.- Parameters:
fpmConfig- map of PHP-FPM configuration- Returns:
- new PhpRuntimeConfig with updated FPM config
-
withOpcacheConfig
Returns a new config with the specified OPcache settings.- Parameters:
opcacheConfig- map of OPcache configuration- Returns:
- new PhpRuntimeConfig with updated OPcache config
-
withMemoryLimit
Returns a new config with the specified memory limit.- Parameters:
memoryLimit- memory_limit in MB- Returns:
- new PhpRuntimeConfig with updated memory limit
-
withMaxExecutionTime
Returns a new config with the specified max execution time.- Parameters:
maxExecutionTime- max_execution_time in seconds- Returns:
- new PhpRuntimeConfig with updated execution time
-
withUploadMaxFilesize
Returns a new config with the specified upload max filesize.- Parameters:
uploadMaxFilesize- upload_max_filesize in MB- Returns:
- new PhpRuntimeConfig with updated upload size
-
withPostMaxSize
Returns a new config with the specified post max size.- Parameters:
postMaxSize- post_max_size in MB- Returns:
- new PhpRuntimeConfig with updated post size
-
getBaseImage
Returns the base Docker image for this PHP version.- Returns:
- PHP-FPM Alpine image tag
-
getPoolName
-
generatePhpIni
Generates php.ini content from configuration.- Returns:
- php.ini content as string
-
generateFpmPoolConfig
Generates PHP-FPM pool configuration content.- Returns:
- PHP-FPM pool configuration as string
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
version
-
extensions
Returns the value of theextensionsrecord component.- Returns:
- the value of the
extensionsrecord component
-
phpIni
-
fpmConfig
-
opcacheConfig
Returns the value of theopcacheConfigrecord component.- Returns:
- the value of the
opcacheConfigrecord component
-
memoryLimit
public int memoryLimit()Returns the value of thememoryLimitrecord component.- Returns:
- the value of the
memoryLimitrecord component
-
maxExecutionTime
public int maxExecutionTime()Returns the value of themaxExecutionTimerecord component.- Returns:
- the value of the
maxExecutionTimerecord component
-
uploadMaxFilesize
public int uploadMaxFilesize()Returns the value of theuploadMaxFilesizerecord component.- Returns:
- the value of the
uploadMaxFilesizerecord component
-
postMaxSize
public int postMaxSize()Returns the value of thepostMaxSizerecord component.- Returns:
- the value of the
postMaxSizerecord component
-