├── 15-symfony-flex-platformsh.yaml ├── 30-symfony-flex.yaml ├── 60-symfony-without-flex.yaml ├── 99-default.yaml ├── php.ini └── upsun ├── 15-symfony-flex-upsun.yaml └── php.ini /15-symfony-flex-platformsh.yaml: -------------------------------------------------------------------------------- 1 | requirements: 2 | - type: file_exists 3 | value: composer.json 4 | - type: has_composer_package 5 | value: symfony/flex 6 | - type: has_composer_package 7 | value: symfonycorp/platformsh-meta 8 | 9 | template: | 10 | name: {{.Slug}} 11 | 12 | type: php:{{.PhpVersion}} 13 | 14 | dependencies: 15 | php: 16 | composer/composer: "^2" 17 | 18 | runtime: 19 | extensions: 20 | {{ range $ext := $.PHPExtensions -}} 21 | {{- if php_extension_available $ext $.PhpVersion -}} 22 | - {{ $ext }} 23 | {{ end -}} 24 | {{- end }} 25 | 26 | {{ if php_at_least "7.4" -}} 27 | variables: 28 | php: 29 | opcache.preload: config/preload.php 30 | {{- end }} 31 | build: 32 | flavor: none 33 | 34 | disk: 1024 35 | 36 | web: 37 | locations: 38 | "/": 39 | root: "{{.PublicDirectory}}" 40 | expires: 1h 41 | passthru: "/{{.FrontController}}" 42 | 43 | mounts: 44 | "/var/cache": { source: local, source_path: var/cache } 45 | {{ if file_exists "templates/debug/source_code.html.twig" -}} 46 | "/data": { source: local, source_path: "data" } 47 | {{- end }} 48 | 49 | {{ if $.Services -}} 50 | relationships: 51 | {{ range $service := $.Services -}} 52 | {{ $service.Name }}: "{{ $service.Name }}:{{ $service.Type }}" 53 | {{ end -}} 54 | {{- end }} 55 | hooks: 56 | build: | 57 | set -x -e 58 | 59 | curl -fs https://get.symfony.com/cloud/configurator | bash 60 | {{ range $ext := $.PHPExtensions -}} 61 | {{- if not (php_extension_available $ext $.PhpVersion) -}} 62 | # php-ext-install {{ $ext }} X.Y.Z 63 | {{ end -}} 64 | {{- end }} 65 | NODE_VERSION=22 symfony-build 66 | 67 | deploy: | 68 | set -x -e 69 | 70 | symfony-deploy 71 | 72 | crons: 73 | security-check: 74 | # Check that no security issues have been found for PHP packages deployed in production 75 | spec: '50 23 * * *' 76 | cmd: if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then croncape COMPOSER_ROOT_VERSION=1.0.0 COMPOSER_AUDIT_ABANDONED=ignore composer audit --no-cache; fi 77 | clean-expired-sessions: 78 | spec: '17,47 * * * *' 79 | cmd: croncape php-session-clean 80 | 81 | {{ if has_composer_package "symfony/messenger" -}} 82 | workers: 83 | messenger: 84 | # PHP background workers usually don't require much CPU. See 85 | # https://symfony.com/doc/current/cloud/cookbooks/resources_allocation.html 86 | # for more information 87 | size: XS 88 | resources: 89 | base_memory: 64 # Keep in sync with the `memory-limit` flag value 90 | memory_ratio: 128 91 | commands: 92 | # Consume "async" messages (as configured in the routing section of config/packages/messenger.yaml) 93 | start: symfony console --time-limit=3600 --memory-limit=64M messenger:consume async 94 | {{- end }} 95 | -------------------------------------------------------------------------------- /30-symfony-flex.yaml: -------------------------------------------------------------------------------- 1 | requirements: 2 | - type: file_exists 3 | value: composer.json 4 | - type: has_composer_package 5 | value: symfony/flex 6 | 7 | template: | 8 | name: {{.Slug}} 9 | 10 | type: php:{{.PhpVersion}} 11 | 12 | runtime: 13 | extensions: 14 | {{ if php_extension_available "apcu" $.PhpVersion -}} 15 | - apcu 16 | {{ end -}} 17 | {{- if php_extension_available "mbstring" $.PhpVersion -}} 18 | - mbstring 19 | {{ end -}} 20 | {{- if php_extension_available "sodium" $.PhpVersion -}} 21 | - sodium 22 | {{ end -}} 23 | {{ range $ext := php_extensions -}} 24 | {{- if php_extension_available $ext $.PhpVersion -}} 25 | - {{ $ext }} 26 | {{ end -}} 27 | {{- end }} 28 | 29 | #variables: 30 | # php: 31 | # # uncomment on PHP 7.4+ 32 | # #opcache.preload: config/preload.php 33 | 34 | build: 35 | flavor: none 36 | 37 | disk: 1024 38 | 39 | web: 40 | locations: 41 | "/": 42 | root: "{{.PublicDirectory}}" 43 | expires: 1h 44 | passthru: "/{{.FrontController}}" 45 | 46 | mounts: 47 | "/var/cache": { source: local, source_path: var/cache } 48 | {{ if file_exists "templates/debug/source_code.html.twig" -}} 49 | "/data": { source: local, source_path: "data" } 50 | {{- end }} 51 | 52 | hooks: 53 | build: | 54 | set -x -e 55 | 56 | curl -fs https://get.symfony.com/cloud/configurator | bash 57 | {{ range $ext := php_extensions -}} 58 | {{- if not (php_extension_available $ext $.PhpVersion) -}} 59 | # php-ext-install {{ $ext }} X.Y.Z 60 | {{ end -}} 61 | {{- end }} 62 | NODE_VERSION=22 symfony-build 63 | 64 | deploy: | 65 | set -x -e 66 | 67 | symfony-deploy 68 | 69 | crons: 70 | security-check: 71 | # Check that no security issues have been found for PHP packages deployed in production 72 | spec: '50 23 * * *' 73 | cmd: if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then croncape COMPOSER_ROOT_VERSION=1.0.0 COMPOSER_AUDIT_ABANDONED=ignore composer audit --no-cache; fi 74 | clean-expired-sessions: 75 | spec: '17,47 * * * *' 76 | cmd: croncape php-session-clean 77 | 78 | {{ if has_composer_package "symfony/messenger" -}} 79 | workers: 80 | messenger: 81 | # PHP background workers usually don't require much CPU. See 82 | # https://symfony.com/doc/current/cloud/cookbooks/resources_allocation.html 83 | # for more information 84 | size: XS 85 | resources: 86 | base_memory: 64 # Keep in sync with the `memory-limit` flag value 87 | memory_ratio: 128 88 | commands: 89 | # Consume "async" messages (as configured in the routing section of config/packages/messenger.yaml) 90 | start: symfony console --time-limit=3600 --memory-limit=64M messenger:consume async 91 | {{- end }} 92 | -------------------------------------------------------------------------------- /60-symfony-without-flex.yaml: -------------------------------------------------------------------------------- 1 | requirements: 2 | - type: file_exists 3 | value: composer.json 4 | - type: has_composer_package 5 | value: symfony/symfony 6 | 7 | template: | 8 | name: {{.Slug}} 9 | 10 | type: php:{{.PhpVersion}} 11 | 12 | runtime: 13 | extensions: 14 | {{ if php_extension_available "apcu" $.PhpVersion -}} 15 | - apcu 16 | {{ end -}} 17 | {{- if php_extension_available "mbstring" $.PhpVersion -}} 18 | - mbstring 19 | {{ end -}} 20 | {{- if php_extension_available "sodium" $.PhpVersion -}} 21 | - sodium 22 | {{ end -}} 23 | {{ range $ext := php_extensions -}} 24 | {{- if php_extension_available $ext $.PhpVersion -}} 25 | - {{ $ext }} 26 | {{ end -}} 27 | {{- end }} 28 | 29 | build: 30 | flavor: none 31 | 32 | disk: 1024 33 | 34 | web: 35 | locations: 36 | "/": 37 | root: "{{.PublicDirectory}}" 38 | expires: 1h 39 | passthru: "/{{.FrontController}}" 40 | 41 | {{ if not (file_exists "app/cache") -}} 42 | # These variables are available at build time 43 | variables: 44 | env: 45 | # Cache dir is set at "var/cache" instead of the legacy default "app/cache" 46 | SYMFONY_APP_CACHE_DIR: "var/cache" 47 | {{- end }} 48 | 49 | mounts: 50 | {{ if file_exists "app/cache" -}} 51 | "app/cache": { source: local, source_path: "var/cache" } 52 | {{- else -}} 53 | "var/cache": { source: local, source_path: "var/cache" } 54 | {{- end }} 55 | {{ if file_exists "app/logs" -}} 56 | "app/logs": { source: local, source_path: "var/logs" } 57 | {{- else -}} 58 | "var/logs": { source: local, source_path: "var/logs" } 59 | {{- end }} 60 | 61 | hooks: 62 | build: | 63 | set -x -e 64 | 65 | curl -fs https://get.symfony.com/cloud/configurator | bash 66 | {{ range $ext := php_extensions -}} 67 | {{- if not (php_extension_available $ext $.PhpVersion) -}} 68 | # php-ext-install {{ $ext }} X.Y.Z 69 | {{ end -}} 70 | {{- end }} 71 | 72 | NODE_VERSION=22 symfony-build 73 | 74 | deploy: | 75 | set -x -e 76 | 77 | symfony-deploy 78 | 79 | crons: 80 | security-check: 81 | # Check that no security issues have been found for PHP packages deployed in production 82 | spec: '50 23 * * *' 83 | cmd: if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then croncape COMPOSER_ROOT_VERSION=1.0.0 COMPOSER_AUDIT_ABANDONED=ignore composer audit --no-cache; fi 84 | clean-expired-sessions: 85 | spec: '17,47 * * * *' 86 | cmd: croncape php-session-clean 87 | 88 | extra_files: 89 | "app/config/parameters_symfonycloud.php": | 90 | = 3.4 and DotEnv. 107 | */ 108 | 109 | $container->setParameter('secret', $_SERVER['APP_SECRET'] ?? $_SERVER['SECRET']); 110 | $container->setParameter('kernel.environment', $_SERVER['APP_ENV'] ?? $_SERVER['SYMFONY_ENV']); 111 | $container->setParameter('kernel.debug', (bool) ($_SERVER['APP_DEBUG'] ?? $_SERVER['SYMFONY_DEBUG'])); 112 | $container->setParameter('router.request_context.host', $_SERVER['SYMFONY_APPLICATION_DEFAULT_ROUTE_HOST']); 113 | $container->setParameter('router.request_context.scheme', $_SERVER['SYMFONY_APPLICATION_DEFAULT_ROUTE_SCHEME']); 114 | 115 | $envMapping = [ 116 | // You need to adapt this list to match your application configuration. 117 | // Please refer to https://symfony.com/doc/master/cloud/services/intro.html 118 | // for environment variable names. 119 | /*'database_host' => 'DATABASE_HOST', 120 | 'database_port' => 'DATABASE_PORT', 121 | 'database_name' => 'DATABASE_NAME', 122 | 'database_user' => 'DATABASE_USER', 123 | 'database_password' => 'DATABASE_PASSWORD',*/ 124 | 'mailer_transport' => 'MAILER_TRANSPORT', 125 | 'mailer_user' => 'MAILER_USER', 126 | 'mailer_password' => 'MAILER_PASSWORD', 127 | 'mailer_host' => 'MAILER_HOST', 128 | 'mailer_port' => 'MAILER_PORT', 129 | ]; 130 | 131 | foreach ($envMapping as $parameter => $env) { 132 | if (!isset($_SERVER[$env])) { 133 | continue; 134 | } 135 | 136 | $container->setParameter($parameter, $_SERVER[$env]); 137 | } 138 | -------------------------------------------------------------------------------- /99-default.yaml: -------------------------------------------------------------------------------- 1 | requirements: 2 | 3 | template: | 4 | name: {{.Slug}} 5 | 6 | type: php:{{.PhpVersion}} 7 | 8 | build: 9 | flavor: none 10 | 11 | # Static website usually don't require much ressources. See 12 | # https://symfony.com/doc/current/cloud/cookbooks/resources_allocation.html 13 | # for more information 14 | size: XS 15 | resources: 16 | base_memory: 64 17 | memory_ratio: 128 18 | 19 | disk: 1024 20 | 21 | web: 22 | commands: 23 | start: sleep 24 | locations: 25 | "/": 26 | root: "{{.PublicDirectory}}" 27 | index: 28 | - "index.html" 29 | scripts: false 30 | expires: 10m 31 | 32 | crons: 33 | security-check: 34 | # Check that no security issues have been found for PHP packages deployed in production 35 | spec: '50 23 * * *' 36 | cmd: if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then COMPOSER_ROOT_VERSION=1.0.0 COMPOSER_AUDIT_ABANDONED=ignore composer audit --no-cache; fi 37 | clean-expired-sessions: 38 | spec: '17,47 * * * *' 39 | cmd: [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean 40 | -------------------------------------------------------------------------------- /php.ini: -------------------------------------------------------------------------------- 1 | allow_url_include=off 2 | display_errors=off 3 | display_startup_errors=off 4 | max_execution_time=30 5 | session.gc_probability=0 6 | session.use_strict_mode=On 7 | realpath_cache_ttl=3600 8 | zend.detect_unicode=Off 9 | -------------------------------------------------------------------------------- /upsun/15-symfony-flex-upsun.yaml: -------------------------------------------------------------------------------- 1 | requirements: 2 | - type: file_exists 3 | value: composer.json 4 | - type: has_composer_package 5 | value: symfony/flex 6 | 7 | template: | 8 | routes: 9 | "https://{all}/": { type: upstream, upstream: "{{.Slug}}:http" } 10 | "http://{all}/": { type: redirect, to: "https://{all}/" } 11 | 12 | services: {{ if not $.Services -}}{}{{ end }} 13 | {{ range $service := $.Services -}} 14 | {{ $service.Name }}: 15 | type: {{ $service.Type }}{{ if $service.Version }}:{{ $service.Version }}{{ end }} 16 | 17 | {{ end }} 18 | 19 | applications: 20 | {{.Slug}}: 21 | source: 22 | root: "/" 23 | 24 | type: php:{{.PhpVersion}} 25 | 26 | runtime: 27 | extensions: 28 | {{ range $ext := $.PHPExtensions -}} 29 | {{- if php_extension_available $ext $.PhpVersion -}} 30 | - {{ $ext }} 31 | {{ end -}} 32 | {{- end }} 33 | 34 | {{ if php_at_least "7.4" -}} 35 | variables: 36 | php: 37 | opcache.preload: config/preload.php 38 | {{- end }} 39 | build: 40 | flavor: none 41 | 42 | web: 43 | locations: 44 | "/": 45 | root: "{{.PublicDirectory}}" 46 | expires: 1h 47 | passthru: "/{{.FrontController}}" 48 | 49 | mounts: 50 | "/var": { source: storage, source_path: var } 51 | {{ if file_exists "templates/debug/source_code.html.twig" -}} 52 | "/data": { source: storage, source_path: "data" } 53 | {{- end }} 54 | 55 | {{ if $.Services -}} 56 | relationships: 57 | {{ range $service := $.Services -}} 58 | {{ $service.Name }}: "{{ $service.Name }}:{{ $service.Type }}" 59 | {{ end -}} 60 | {{- end }} 61 | hooks: 62 | build: | 63 | set -x -e 64 | 65 | curl -fs https://get.symfony.com/cloud/configurator | bash 66 | {{ range $ext := $.PHPExtensions -}} 67 | {{- if not (php_extension_available $ext $.PhpVersion) -}} 68 | # php-ext-install {{ $ext }} X.Y.Z 69 | {{ end -}} 70 | {{- end }} 71 | NODE_VERSION=22 symfony-build 72 | 73 | deploy: | 74 | set -x -e 75 | 76 | symfony-deploy 77 | 78 | crons: 79 | security-check: 80 | # Check that no security issues have been found for PHP packages deployed in production 81 | spec: '50 23 * * *' 82 | cmd: if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then croncape COMPOSER_ROOT_VERSION=1.0.0 COMPOSER_AUDIT_ABANDONED=ignore composer audit --no-cache; fi 83 | clean-expired-sessions: 84 | spec: '17,47 * * * *' 85 | cmd: croncape php-session-clean 86 | 87 | {{ if has_composer_package "symfony/messenger" -}} 88 | workers: 89 | messenger: 90 | commands: 91 | # Consume "async" messages (as configured in the routing section of config/packages/messenger.yaml) 92 | start: symfony console --time-limit=3600 --memory-limit=64M messenger:consume async 93 | {{- end }} 94 | -------------------------------------------------------------------------------- /upsun/php.ini: -------------------------------------------------------------------------------- 1 | allow_url_include=off 2 | display_errors=off 3 | display_startup_errors=off 4 | max_execution_time=30 5 | session.use_strict_mode=On 6 | realpath_cache_ttl=3600 7 | zend.detect_unicode=Off 8 | --------------------------------------------------------------------------------