Skip to content

Commit

Permalink
Add demo-project for sf 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Zombaya committed Dec 9, 2023
1 parent d42637b commit a05da56
Show file tree
Hide file tree
Showing 35 changed files with 978 additions and 0 deletions.
2 changes: 2 additions & 0 deletions demo/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
],
"installScripts" : [
"Kporras07\\ComposerSymlinks\\ScriptHandler::createSymlinks",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony5.4/.env.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony5.4/.env.test.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony6.x/.env.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony6.x/.env.test.local",
"printf 'HALITE_SECRET=\"%s\"' \"$(cat shared/.Halite.key)\" > symfony7.x/.env.local",
Expand Down
30 changes: 30 additions & 0 deletions demo/symfony5.4/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# In all environments, the following files are loaded if they exist,
# the latter 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.
# https://symfony.com/doc/current/configuration/secrets.html
#
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration

###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=14c3830cbb94843160a2bd67387a59e4
###< symfony/framework-bundle ###

###> doctrine/doctrine-bundle ###
# Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
#
# DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
# DATABASE_URL="mysql://app:!ChangeMe!@127.0.0.1:3306/app?serverVersion=8&charset=utf8mb4"
DATABASE_PATH="var/data.db"
DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"
###< doctrine/doctrine-bundle ###
6 changes: 6 additions & 0 deletions demo/symfony5.4/.env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# define your env variables for the test env here
KERNEL_CLASS='App\Kernel'
APP_SECRET='$ecretf0rt3st'
SYMFONY_DEPRECATIONS_HELPER=999999
PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
21 changes: 21 additions & 0 deletions demo/symfony5.4/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Ignore symlinks
/templates
/var/data.db
/.Halite.key
# Ignore lock-file
/composer.lock

###> symfony/framework-bundle ###
/.env.local
/.env.local.php
/.env.*.local
/config/secrets/prod/prod.decrypt.private.php
/public/bundles/
/var/
/vendor/
###< symfony/framework-bundle ###

###> symfony/phpunit-bridge ###
.phpunit.result.cache
/phpunit.xml
###< symfony/phpunit-bridge ###
17 changes: 17 additions & 0 deletions demo/symfony5.4/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;

if (!is_file(dirname(__DIR__).'/vendor/autoload_runtime.php')) {
throw new LogicException('Symfony Runtime is missing. Try running "composer require symfony/runtime".');
}

require_once dirname(__DIR__).'/vendor/autoload_runtime.php';

return function (array $context) {
$kernel = new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);

return new Application($kernel);
};
19 changes: 19 additions & 0 deletions demo/symfony5.4/bin/phpunit
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php

if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'UTC');
}

if (is_file(dirname(__DIR__).'/vendor/phpunit/phpunit/phpunit')) {
define('PHPUNIT_COMPOSER_INSTALL', dirname(__DIR__).'/vendor/autoload.php');
require PHPUNIT_COMPOSER_INSTALL;
PHPUnit\TextUI\Command::main();
} else {
if (!is_file(dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php')) {
echo "Unable to find the `simple-phpunit.php` script in `vendor/symfony/phpunit-bridge/bin/`.\n";
exit(1);
}

require dirname(__DIR__).'/vendor/symfony/phpunit-bridge/bin/simple-phpunit.php';
}
79 changes: 79 additions & 0 deletions demo/symfony5.4/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=7.2.5",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrineencryptbundle/doctrine-encrypt-bundle": "@dev",
"doctrine/persistence": "^3.2",
"paragonie/halite": "^5.0",
"symfony/console": "5.4.*",
"symfony/dotenv": "5.4.*",
"symfony/flex": "^1.17|^2",
"symfony/framework-bundle": "5.4.*",
"symfony/runtime": "5.4.*",
"symfony/twig-bundle": "5.4.*",
"symfony/yaml": "5.4.*"
},
"config": {
"allow-plugins": {
"composer/package-versions-deprecated": true,
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.4.*"
}
},
"repositories": [
{
"type": "path",
"url": "../../"
}
],
"require-dev": {
"symfony/phpunit-bridge": "^6.3"
}
}
8 changes: 8 additions & 0 deletions demo/symfony5.4/config/bundles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php

return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Ambta\DoctrineEncryptBundle\AmbtaDoctrineEncryptBundle::class => ['all' => true],
];
3 changes: 3 additions & 0 deletions demo/symfony5.4/config/packages/ambta_doctrine_encrypt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ambta_doctrine_encrypt:
enable_secret_generation: false
secret: '%env(HALITE_SECRET)%'
19 changes: 19 additions & 0 deletions demo/symfony5.4/config/packages/cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
framework:
cache:
# Unique name of your app: used to compute stable namespaces for cache keys.
#prefix_seed: your_vendor_name/app_name

# The "app" cache stores to the filesystem by default.
# The data in this cache should persist between deploys.
# 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
50 changes: 50 additions & 0 deletions demo/symfony5.4/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'

# IMPORTANT: You MUST configure your server version,
# either here or in the DATABASE_URL env var (see .env file)
#server_version: '15'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
Annotation:
type: 'annotation'
is_bundle: false
dir: '%kernel.project_dir%/src/Entity/Annotation'
prefix: 'App\Entity\Annotation'
alias: App
Attributes:
type: 'attribute'
is_bundle: false
dir: '%kernel.project_dir%/src/Entity/Attribute'
prefix: 'App\Entity\Attribute'
alias: App

when@test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'

when@prod:
doctrine:
orm:
auto_generate_proxy_classes: false
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool

framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system
24 changes: 24 additions & 0 deletions demo/symfony5.4/config/packages/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
#csrf_protection: true
http_method_override: 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
storage_factory_id: session.storage.factory.native

#esi: true
#fragments: true
php_errors:
log: true

when@test:
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file
12 changes: 12 additions & 0 deletions demo/symfony5.4/config/packages/routing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
framework:
router:
utf8: true

# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
#default_uri: http://localhost

when@prod:
framework:
router:
strict_requirements: null
6 changes: 6 additions & 0 deletions demo/symfony5.4/config/packages/twig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
twig:
default_path: '%kernel.project_dir%/templates'

when@test:
twig:
strict_variables: true
5 changes: 5 additions & 0 deletions demo/symfony5.4/config/preload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
}
3 changes: 3 additions & 0 deletions demo/symfony5.4/config/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#index:
# path: /
# controller: App\Controller\DefaultController::index
7 changes: 7 additions & 0 deletions demo/symfony5.4/config/routes/annotations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
controllers:
resource: ../../src/Controller/
type: annotation

kernel:
resource: ../../src/Kernel.php
type: annotation
4 changes: 4 additions & 0 deletions demo/symfony5.4/config/routes/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
when@dev:
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error
24 changes: 24 additions & 0 deletions demo/symfony5.4/config/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# 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.html#use-parameters-for-application-configuration
parameters:

services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.

# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/'
exclude:
- '../src/DependencyInjection/'
- '../src/Entity/'
- '../src/Kernel.php'

# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
Loading

0 comments on commit a05da56

Please sign in to comment.