Skip to content
Permalink
Browse files

chore: Updated all Symfony recipes.

  • Loading branch information...
tarlepp committed Oct 20, 2019
1 parent 298802b commit f07b1048c0e8f74db1ffc2b265db7efd0bcf2761
20 .env
@@ -1,6 +1,22 @@
# This file is a "template" of which env vars needs to be defined in your configuration or in an .env file
# Set variables here that may be different on each deployment target of the app, e.g. development, staging, production.
# In all environments, the following files are loaded if they exist,
# the later taking precedence over the former:
#
# * .env contains default values for the environment variables needed by the app
# * .env.local uncommitted file with local overrides
# * .env.$APP_ENV committed environment-specific defaults
# * .env.$APP_ENV.local uncommitted environment-specific overrides
#
# Real environment variables win over .env files.
#
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
#
# Within this `symfony-flex-backend` all the secrets are defined in that `secrets/application.json` file,
# which is meant to be mounted within Kubernetes envrinment from secrets.
#
# See `doc/CUSTOM_CONFIGURATION.md` for more information about that.

###> symfony/framework-bundle ###
APP_ENV=dev
@@ -1,7 +1,7 @@
###> symfony/framework-bundle ###
/.env.local
/.env.*.local
/.env.local.php
/.env.*.local
/public/bundles/
/var/
/vendor/
@@ -9,7 +9,11 @@ use Symfony\Component\Debug\Debug;
set_time_limit(0);
require __DIR__ . '/../vendor/autoload.php';
if (in_array(PHP_SAPI, ['cli', 'phpdbg', 'embed'], true) === false) {
echo 'Warning: The console should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL;
}
require dirname(__DIR__) . '/vendor/autoload.php';
if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
@@ -96,9 +96,10 @@
},
"scripts": {
"auto-scripts": {
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
"cache:clear": "symfony-cmd",
"cache:warmup": "symfony-cmd"
"cache:warmup": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
"security-checker security:check": "script"
},
"post-install-cmd": [
"if test -d vendor/symfony/requirements-checker; then ./vendor/bin/requirements-checker; fi",
@@ -30,4 +30,7 @@
$_SERVER += $_ENV;
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'dev';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? $_SERVER['APP_ENV'] !== 'prod';
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
$debug = (int)$_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = $debug;
@@ -0,0 +1,22 @@
framework:
cache:
# Put the unique name of your app here: the prefix seed
# is used to compute stable namespaces for cache keys.
prefix_seed: tarlepp/symfony-flex-backend

# The app cache caches to the filesystem by default.
# Other options include:

# Redis
#app: cache.adapter.redis
#default_redis_provider: redis://localhost

# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
#app: cache.adapter.apcu

# Namespaced pools use the above "app" backend by default
#pools:
#my.dedicated.cache: null
pools:
app.version.cache:
adapter: cache.adapter.apcu
@@ -1,20 +1,23 @@
doctrine:
dbal:
url: '%env(DATABASE_URL)%'
url: '%env(resolve:DATABASE_URL)%'
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
mapping_types:
enum: string
types:
datetime: App\Doctrine\DBAL\Types\UTCDateTimeType
datetimetz: App\Doctrine\DBAL\Types\UTCDateTimeType
EnumLogLogin: App\Doctrine\DBAL\Types\EnumLogLoginType
orm:
auto_generate_proxy_classes: '%kernel.debug%'
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity\'
prefix: 'App\Entity'
alias: App
@@ -1,14 +1,20 @@
# See docs https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
csrf_protection: false
#http_method_override: true

serializer:
enable_annotations: true
csrf_protection: false

# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
#session:
# handler_id: null
# cookie_secure: auto
# cookie_samesite: lax

#esi: true
#fragments: true
php_errors:
log: true
router:
strict_requirements: null
cache:
pools:
app.version.cache:
adapter: cache.adapter.apcu
@@ -1,6 +1,6 @@
lexik_jwt_authentication:
secret_key: '%kernel.project_dir%/%env(JWT_PRIVATE_KEY_PATH)%'
public_key: '%kernel.project_dir%/%env(JWT_PUBLIC_KEY_PATH)%'
secret_key: '%kernel.project_dir%/%env(resolve:JWT_PRIVATE_KEY_PATH)%'
public_key: '%kernel.project_dir%/%env(resolve:JWT_PUBLIC_KEY_PATH)%'
pass_phrase: '%env(JWT_PASSPHRASE)%'

# token extraction settings
@@ -4,6 +4,7 @@ nelmio_cors:
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
allow_headers: ['Content-Type', 'Authorization']
expose_headers: ['Link']
max_age: 3600
paths:
'^/': ~
@@ -1,5 +1,32 @@
doctrine:
orm:
metadata_cache_driver: apcu
result_cache_driver: apcu
query_cache_driver: apcu
auto_generate_proxy_classes: false
metadata_cache_driver:
type: service
id: doctrine.system_cache_provider
query_cache_driver:
type: service
id: doctrine.system_cache_provider
result_cache_driver:
type: service
id: doctrine.result_cache_provider

services:
doctrine.result_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.result_cache_pool'
doctrine.system_cache_provider:
class: Symfony\Component\Cache\DoctrineProvider
public: false
arguments:
- '@doctrine.system_cache_pool'

framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system
@@ -4,17 +4,23 @@ monolog:
type: fingers_crossed
action_level: error
handler: nested
excluded_404s:
# regex: exclude all 404 errors from the logs
- ^/
excluded_http_codes: [404, 405]
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
channels: ['!event', '!doctrine']
deprecation:
type: stream
path: '%kernel.logs_dir%/%kernel.environment%.deprecations.log'
deprecation_filter:
type: filter
handler: deprecation
max_level: info
channels: ['php']
buffered:
type: buffer
handler: easylog
@@ -1,3 +1,4 @@
framework:
router:
strict_requirements: ~
strict_requirements: null
utf8: true
@@ -3,6 +3,6 @@ services:
autowire: true
autoconfigure: true

SensioLabs\Security\SecurityChecker: ~
SensioLabs\Security\SecurityChecker: null

SensioLabs\Security\Command\SecurityCheckerCommand: ~
SensioLabs\Security\Command\SecurityCheckerCommand: null
@@ -2,9 +2,9 @@ monolog:
handlers:
main:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: error
channels: ["!event"]
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
channels: ['!event']
buffered:
type: buffer
handler: easylog
@@ -0,0 +1,3 @@
framework:
router:
strict_requirements: true
@@ -0,0 +1,3 @@
framework:
validation:
not_compromised_password: false
@@ -1,6 +1,6 @@
framework:
default_locale: '%locale%'
default_locale: en
translator:
default_path: '%kernel.project_dir%/translations'
fallbacks:
- '%locale%'
- en
@@ -1,4 +1,4 @@
twig:
paths: ['%kernel.project_dir%/templates']
default_path: '%kernel.project_dir%/templates'
debug: '%kernel.debug%'
strict_variables: '%kernel.debug%'
@@ -1,3 +1,8 @@
framework:
validation:
email_validation_mode: html5

# Enables validator auto-mapping support.
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
#auto_mapping:
# App\Entity\: []
@@ -0,0 +1,3 @@
#index:
# path: /
# controller: App\Controller\DefaultController::index
@@ -1,3 +1,3 @@
_errors:
resource: '@TwigBundle/Resources/config/routing/errors.xml'
prefix: /_error
prefix: /_error
@@ -1,3 +1,6 @@
# This file is the entry point to configure your own services.
# Files in the packages/ subdirectory configure your dependencies.

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
@@ -32,14 +35,16 @@ services:
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{Entity,EventListener,Migrations,Tests,Kernel.php}'
exclude: '../src/{DependencyInjection,Entity,EventListener,Migrations,Tests,Kernel.php}'

# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller/*'
resource: '../src/Controller'
tags: [ 'controller.service_arguments' ]

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
App\DataFixtures\:
resource: '../src/DataFixtures/*'
tags: [ 'doctrine.fixture.orm' ]

0 comments on commit f07b104

Please sign in to comment.
You can’t perform that action at this time.