From 008c341ceb6d6d8474c0c8cfdbebb6463a37b0ae Mon Sep 17 00:00:00 2001 From: jannisp Date: Thu, 22 Apr 2021 12:46:14 +0200 Subject: [PATCH] basic setup with twig --- composer.json | 7 +- composer.lock | 441 ++++++++++++++++++++++++++++++++- config/bundles.php | 2 + config/packages/test/twig.yaml | 2 + config/packages/twig.yaml | 2 + symfony.lock | 29 +++ templates/base.html.twig | 19 ++ 7 files changed, 498 insertions(+), 4 deletions(-) create mode 100644 config/packages/test/twig.yaml create mode 100644 config/packages/twig.yaml create mode 100644 templates/base.html.twig diff --git a/composer.json b/composer.json index a95524c..0dd760e 100644 --- a/composer.json +++ b/composer.json @@ -11,9 +11,10 @@ "symfony/dotenv": "5.2.*", "symfony/flex": "^1.3.1", "symfony/framework-bundle": "5.2.*", - "symfony/yaml": "5.2.*" - }, - "require-dev": { + "symfony/twig-bundle": "5.2.*", + "symfony/yaml": "5.2.*", + "twig/extra-bundle": "^2.12|^3.0", + "twig/twig": "^2.12|^3.0" }, "config": { "optimize-autoloader": true, diff --git a/composer.lock b/composer.lock index c5a482d..063db0d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "ddab81359814b88dad27a2f6d961a375", + "content-hash": "fee0444f3bce0bd9f6d19f7caab000fc", "packages": [ { "name": "psr/cache", @@ -2271,6 +2271,291 @@ ], "time": "2021-03-17T17:12:15+00:00" }, + { + "name": "symfony/translation-contracts", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/translation-contracts.git", + "reference": "95c812666f3e91db75385749fe219c5e494c7f95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/95c812666f3e91db75385749fe219c5e494c7f95", + "reference": "95c812666f3e91db75385749fe219c5e494c7f95", + "shasum": "" + }, + "require": { + "php": ">=7.2.5" + }, + "suggest": { + "symfony/translation-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.4-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Translation\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to translation", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/translation-contracts/tree/v2.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-03-23T23:28:01+00:00" + }, + { + "name": "symfony/twig-bridge", + "version": "v5.2.6", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bridge.git", + "reference": "a65d8d38c66f147f29b73d53d14e8c9a983653b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/a65d8d38c66f147f29b73d53d14e8c9a983653b8", + "reference": "a65d8d38c66f147f29b73d53d14e8c9a983653b8", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.15", + "symfony/translation-contracts": "^1.1|^2", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "phpdocumentor/reflection-docblock": "<3.2.2", + "phpdocumentor/type-resolver": "<1.4.0", + "symfony/console": "<4.4", + "symfony/form": "<5.1", + "symfony/http-foundation": "<4.4", + "symfony/http-kernel": "<4.4", + "symfony/translation": "<5.2", + "symfony/workflow": "<5.2" + }, + "require-dev": { + "egulias/email-validator": "^2.1.10|^3", + "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0", + "symfony/asset": "^4.4|^5.0", + "symfony/console": "^4.4|^5.0", + "symfony/dependency-injection": "^4.4|^5.0", + "symfony/expression-language": "^4.4|^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/form": "^5.1.9", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/http-kernel": "^4.4|^5.0", + "symfony/intl": "^4.4|^5.0", + "symfony/mime": "^5.2", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/property-info": "^4.4|^5.1", + "symfony/routing": "^4.4|^5.0", + "symfony/security-acl": "^2.8|^3.0", + "symfony/security-core": "^4.4|^5.0", + "symfony/security-csrf": "^4.4|^5.0", + "symfony/security-http": "^4.4|^5.0", + "symfony/serializer": "^5.2", + "symfony/stopwatch": "^4.4|^5.0", + "symfony/translation": "^5.2", + "symfony/web-link": "^4.4|^5.0", + "symfony/workflow": "^5.2", + "symfony/yaml": "^4.4|^5.0", + "twig/cssinliner-extra": "^2.12|^3", + "twig/inky-extra": "^2.12|^3", + "twig/markdown-extra": "^2.12|^3" + }, + "suggest": { + "symfony/asset": "For using the AssetExtension", + "symfony/expression-language": "For using the ExpressionExtension", + "symfony/finder": "", + "symfony/form": "For using the FormExtension", + "symfony/http-kernel": "For using the HttpKernelExtension", + "symfony/routing": "For using the RoutingExtension", + "symfony/security-core": "For using the SecurityExtension", + "symfony/security-csrf": "For using the CsrfExtension", + "symfony/security-http": "For using the LogoutUrlExtension", + "symfony/stopwatch": "For using the StopwatchExtension", + "symfony/translation": "For using the TranslationExtension", + "symfony/var-dumper": "For using the DumpExtension", + "symfony/web-link": "For using the WebLinkExtension", + "symfony/yaml": "For using the YamlExtension" + }, + "type": "symfony-bridge", + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Twig\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides integration for Twig with various Symfony components", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/twig-bridge/tree/v5.2.6" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-03-16T09:10:13+00:00" + }, + { + "name": "symfony/twig-bundle", + "version": "v5.2.4", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bundle.git", + "reference": "5ebbb5f0e8bfaa0b4b37cb25ff97f83b18caf221" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bundle/zipball/5ebbb5f0e8bfaa0b4b37cb25ff97f83b18caf221", + "reference": "5ebbb5f0e8bfaa0b4b37cb25ff97f83b18caf221", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/config": "^4.4|^5.0", + "symfony/http-foundation": "^4.4|^5.0", + "symfony/http-kernel": "^5.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/twig-bridge": "^5.0", + "twig/twig": "^2.13|^3.0.4" + }, + "conflict": { + "symfony/dependency-injection": "<5.2", + "symfony/framework-bundle": "<5.0", + "symfony/translation": "<5.0" + }, + "require-dev": { + "doctrine/annotations": "^1.10.4", + "doctrine/cache": "~1.0", + "symfony/asset": "^4.4|^5.0", + "symfony/dependency-injection": "^5.2", + "symfony/expression-language": "^4.4|^5.0", + "symfony/finder": "^4.4|^5.0", + "symfony/form": "^4.4|^5.0", + "symfony/framework-bundle": "^5.0", + "symfony/routing": "^4.4|^5.0", + "symfony/stopwatch": "^4.4|^5.0", + "symfony/translation": "^5.0", + "symfony/web-link": "^4.4|^5.0", + "symfony/yaml": "^4.4|^5.0" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Symfony\\Bundle\\TwigBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a tight integration of Twig into the Symfony full-stack framework", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/twig-bundle/tree/v5.2.4" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2021-01-27T10:15:41+00:00" + }, { "name": "symfony/var-dumper", "version": "v5.2.6", @@ -2506,6 +2791,160 @@ } ], "time": "2021-03-06T07:59:01+00:00" + }, + { + "name": "twig/extra-bundle", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/twig-extra-bundle.git", + "reference": "e2d27a86c3f47859eb07808fa7c8679d30fcbdde" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/twig-extra-bundle/zipball/e2d27a86c3f47859eb07808fa7c8679d30fcbdde", + "reference": "e2d27a86c3f47859eb07808fa7c8679d30fcbdde", + "shasum": "" + }, + "require": { + "php": "^7.1.3|^8.0", + "symfony/framework-bundle": "^4.3|^5.0", + "symfony/twig-bundle": "^4.3|^5.0", + "twig/twig": "^2.4|^3.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^4.4.9|^5.0.9", + "twig/cache-extra": "^3.0", + "twig/cssinliner-extra": "^2.12|^3.0", + "twig/html-extra": "^2.12|^3.0", + "twig/inky-extra": "^2.12|^3.0", + "twig/intl-extra": "^2.12|^3.0", + "twig/markdown-extra": "^2.12|^3.0", + "twig/string-extra": "^2.12|^3.0" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Twig\\Extra\\TwigExtraBundle\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + } + ], + "description": "A Symfony bundle for extra Twig extensions", + "homepage": "https://twig.symfony.com", + "keywords": [ + "bundle", + "extra", + "twig" + ], + "support": { + "source": "https://github.com/twigphp/twig-extra-bundle/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2021-02-06T21:13:17+00:00" + }, + { + "name": "twig/twig", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5", + "reference": "1f3b7e2c06cc05d42936a8ad508ff1db7975cdc5", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/phpunit-bridge": "^4.4.9|^5.0.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "support": { + "issues": "https://github.com/twigphp/Twig/issues", + "source": "https://github.com/twigphp/Twig/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/twig/twig", + "type": "tidelift" + } + ], + "time": "2021-02-08T09:54:36+00:00" } ], "packages-dev": [], diff --git a/config/bundles.php b/config/bundles.php index 49d3fb6..4ce0d70 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -2,4 +2,6 @@ return [ Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true], + Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true], + Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], ]; diff --git a/config/packages/test/twig.yaml b/config/packages/test/twig.yaml new file mode 100644 index 0000000..8c6e0b4 --- /dev/null +++ b/config/packages/test/twig.yaml @@ -0,0 +1,2 @@ +twig: + strict_variables: true diff --git a/config/packages/twig.yaml b/config/packages/twig.yaml new file mode 100644 index 0000000..b3cdf30 --- /dev/null +++ b/config/packages/twig.yaml @@ -0,0 +1,2 @@ +twig: + default_path: '%kernel.project_dir%/templates' diff --git a/symfony.lock b/symfony.lock index 24e2e6b..1834b8c 100644 --- a/symfony.lock +++ b/symfony.lock @@ -132,6 +132,29 @@ "symfony/string": { "version": "v5.2.6" }, + "symfony/translation-contracts": { + "version": "v2.4.0" + }, + "symfony/twig-bridge": { + "version": "v5.2.6" + }, + "symfony/twig-bundle": { + "version": "5.0", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "5.0", + "ref": "fab9149bbaa4d5eca054ed93f9e1b66cc500895d" + }, + "files": [ + "config/packages/test/twig.yaml", + "config/packages/twig.yaml", + "templates/base.html.twig" + ] + }, + "symfony/twig-pack": { + "version": "v1.0.1" + }, "symfony/var-dumper": { "version": "v5.2.6" }, @@ -140,5 +163,11 @@ }, "symfony/yaml": { "version": "v5.2.5" + }, + "twig/extra-bundle": { + "version": "v3.3.0" + }, + "twig/twig": { + "version": "v3.3.0" } } diff --git a/templates/base.html.twig b/templates/base.html.twig new file mode 100644 index 0000000..16d7273 --- /dev/null +++ b/templates/base.html.twig @@ -0,0 +1,19 @@ + + + + + {% block title %}Welcome!{% endblock %} + {# Run `composer require symfony/webpack-encore-bundle` + and uncomment the following Encore helpers to start using Symfony UX #} + {% block stylesheets %} + {#{{ encore_entry_link_tags('app') }}#} + {% endblock %} + + {% block javascripts %} + {#{{ encore_entry_script_tags('app') }}#} + {% endblock %} + + + {% block body %}{% endblock %} + +